https://github.com/andreasfischer1985/code-snippets
miscellaneous code snippets
https://github.com/andreasfischer1985/code-snippets
Last synced: 8 months ago
JSON representation
miscellaneous code snippets
- Host: GitHub
- URL: https://github.com/andreasfischer1985/code-snippets
- Owner: AndreasFischer1985
- Created: 2019-02-10T20:58:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-13T13:23:22.000Z (over 1 year ago)
- Last Synced: 2025-03-29T23:22:39.467Z (9 months ago)
- Language: R
- Size: 2.75 MB
- Stars: 21
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Miscellaneous code snippets
Small code snippets in different languages (mostly R, Python, Bash, PHP & HTML/JS/CSS).
## [Python section](https://github.com/AndreasFischer1985/code-snippets/tree/master/py)
The py-Files contain
- examples of [how to generate graphs and subgraphs using the networkx library](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/networkx_KnolwedgeGraphs%26Subgraphs.py) or [how to build knowledge graphs from data on BERUFENET](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/BERUFENET_KnowledgeGraphExample.py)
- examples of gradio [interfaces to Large Language Models (LLMs)](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/AI_Gradio_Interface.py), and to [LLMs with Retrieval-Augmented Generation on premises](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/AI_Gradio_Interface_RAG.py).
- working examples of basic AI applications (e.g. a free & open-source [document-based Q&A-bot](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/document-based_Q%26A_AI.py) or several [LangChain-Applications](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/LangChain_HuggingFace_examples.py) based on large language models from huggingface.co) and
- code to interact with smart home devices (e.g., [switching a Link2Home-socket on/off via WiFi](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/wifi_switching_Link2HomeSocket.py) or [reading BLE advertisements of Xiaomi Mi sensors](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/bluetooth_scanning_ATC_MiThermometer.py))
## [R section](https://github.com/AndreasFischer1985/code-snippets/tree/master/R)
The R-files are a mixed bag of interesting functions and applications, e.g.,
- examples of how to [interact with AI-models on huggingface.co via API](https://github.com/AndreasFischer1985/code-snippets/blob/master/R/huggingface_requests.R) from within R or how to [request sentence embeddings](https://github.com/AndreasFischer1985/code-snippets/blob/master/R/huggingface_SentenceEmbeddingsTest.R),
- exemplary [gradio-interface to a FOSS Large Language Model](https://github.com/AndreasFischer1985/code-snippets/blob/master/py/AI_Gradio_Interface.py),
- code for [generating](https://github.com/AndreasFischer1985/code-snippets/blob/master/R/qqBaseX-package.R) the complete [qqBaseX-package](https://github.com/AndreasFischer1985/qqBaseX) from within R
- code for plotting several kinds of 3D-graphs and objects in R without any dependencies on additional packages
## [Bash section](https://github.com/AndreasFischer1985/code-snippets/tree/master/)
The sh-files contain some scripts for interacting with [ChatGPT & GPT3 via API](https://github.com/AndreasFischer1985/code-snippets/blob/master/GPT3.5-API-examples.sh) and for interacting with [Free Open Source AI on your local machine](https://github.com/AndreasFischer1985/code-snippets/blob/master/Local_FOSS_LLMs.sh).
## [HTML section](https://github.com/AndreasFischer1985/code-snippets/tree/master/html)
Html files mostly demonstrate some frontend functionalities based on JavaScript or CSS.
They can also be seen in action thanks to GitHub Pages:
| Snippet | Link |
|---|---|
| BERUFENET.AI Application | [html/js_berufenet.ai.html](https://andreasfischer1985.github.io/code-snippets/html/js_berufenet.ai.html) |
| Huggingface AI Interface | [html/js_AIInterface.html](https://andreasfischer1985.github.io/code-snippets/html/js_AIInterface.html) |
| Bloom Demo | [html/js_bloom.html](https://andreasfischer1985.github.io/code-snippets/html/js_bloom.html) |
| ChatGPT Demo | [html/js_ChatGPT.html](https://andreasfischer1985.github.io/code-snippets/html/js_ChatGPT.html) |
| Eliza Demo | [html/eliza32.html](https://andreasfischer1985.github.io/code-snippets/html/eliza32.html) |
| Display JSON | [html/js_displayJSON.html](https://andreasfischer1985.github.io/code-snippets/html/js_displayJSON.html) |
| Filter JSON | [html/js_filterJSON.html](https://andreasfischer1985.github.io/code-snippets/html/js_filterJSON.html) |
| API Collection | [html/js_apiCollection.html](https://andreasfischer1985.github.io/code-snippets/html/js_apiCollection.html) |
| Profilbildung| [html/js_profilbildung.html](https://andreasfischer1985.github.io/code-snippets/html/js_profilbildung.html) |
| Loading Animation | [html/css_loading_animation_atom.html](https://andreasfischer1985.github.io/code-snippets/html/css_loading_animation_atom.html) |
| Smart City Dashboard | [html/mockup_SmartCityDashboard.html](https://andreasfischer1985.github.io/code-snippets/html/mockup_SmartCityDashboard.html) |
| Pyscript Demo | [html/demo_pyscript.html](https://andreasfischer1985.github.io/code-snippets/html/demo_pyscript.html) |
| Particles Demo | [html/demo_particles.js.html](https://andreasfischer1985.github.io/code-snippets/html/demo_particles.js.html) |
| Typewriter Demo | [html/demo_typewriter.html](https://andreasfischer1985.github.io/code-snippets/html/demo_typewriter.html) |
| Simple Switch | [html/switch.html](https://andreasfischer1985.github.io/code-snippets/html/switch.html) |
## [PHP section](https://github.com/AndreasFischer1985/code-snippets/tree/master/php)
Php files mostly demonstrate basic backend functionalities:
| Snippet | Link |
|---|---|
| Login Example | [php/login_example.php](https://github.com/AndreasFischer1985/code-snippets/blob/master/php/login_example.php) |
| Search Example | [php/sql_search_example.php](https://github.com/AndreasFischer1985/code-snippets/blob/master/php/sql_search_example.php) |
| Chat Example | [php/sql_chat_example.php](https://github.com/AndreasFischer1985/code-snippets/blob/master/php/sql_chat_example.php) |
| API Example | [php/ausbildungssuche_api_example.php](https://github.com/AndreasFischer1985/code-snippets/blob/master/php/ausbildungssuche_api_example.php) |
| Dashboard Example | [php/ausbildungssuche_dashboard_example.php](https://github.com/AndreasFischer1985/code-snippets/blob/master/php/ausbildungssuche_dashboard_example.php) |