Skip to content

Instantly share code, notes, and snippets.

@mberman84
mberman84 / gist:ea207e7d9e5f8c5f6a3252883ef16df3
Created November 29, 2023 15:31
AutoGen + Ollama Instructions
1. # create new .py file with code found below
2. # install ollama
3. # install model you want “ollama run mistral”
4. conda create -n autogen python=3.11
5. conda activate autogen
6. which python
7. python -m pip install pyautogen
7. ollama run mistral
8. ollama run codellama
9. # open new terminal
@Ikhiloya
Ikhiloya / SyncDataWorker.java
Created September 23, 2019 14:36
A WorkManager Worker class that fetches data from the internet and saves it to Android Room database
public class SyncDataWorker extends Worker {
private BookService bookService;
private BookDao bookDao;
private static final String TAG = SyncDataWorker.class.getSimpleName();
public SyncDataWorker(@NonNull Context appContext, @NonNull WorkerParameters workerParams) {
super(appContext, workerParams);
bookService = App.get().getBookService();
bookDao = App.get().getBookDao();
@ibuildthecloud
ibuildthecloud / README.md
Last active June 19, 2025 07:09
k3s on WSL2

Instructions to hack up WSL2 on Windows 10 Build 18917 to run k3s (Kubernetes) and rio

Install WSL2

https://docs.microsoft.com/en-us/windows/wsl/wsl2-install

I already had Ubuntu-18.04 installed in wsl 1. So I just did wsl --set-version Ubuntu-18.04 2

Compile Kernel

Using Ubuntu 18.04 (I'm sure any distro will work), inside WSL2 download https://thirdpartysource.microsoft.com/download/Windows%20Subsystem%20for%20Linux%20v2/May%202019/WSLv2-Linux-Kernel-master.zip and extract to a folder. The latest version of the kernel source is available at (https://github.com/microsoft/WSL2-Linux-Kernel)

@dsuess
dsuess / Dockerfile
Last active July 31, 2024 10:11
xeus-cling C++ Jupyter kernel inside a docker container
FROM frolvlad/alpine-miniconda3
RUN conda install -y -c conda-forge bash jupyter jupyter_contrib_nbextensions
RUN conda install -y -c conda-forge xeus-cling xtensor
RUN mkdir /notebooks
@fnky
fnky / ANSI.md
Last active October 28, 2025 09:25
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@michidk
michidk / apacheds-deployment.yaml
Last active January 22, 2022 10:58
Kubernetes Apacheds
apiVersion: apps/v1
kind: Deployment
metadata:
name: apacheds
labels:
app: apacheds
spec:
replicas: 1
selector:
matchLabels:
# Both inputs are 1-dimensional
book = Input(name = 'book', shape = [1])
link = Input(name = 'link', shape = [1])
# Embedding the book (shape will be (None, 1, 50))
book_embedding = Embedding(name = 'book_embedding',
input_dim = len(book_index),
output_dim = embedding_size)(book)
# Embedding the link (shape will be (None, 1, 50))
@AO8
AO8 / crawler.py
Last active May 23, 2023 09:12
Crawl a website and gather all internal links with Python and BeautifulSoup.
# Adapted from example in Ch.3 of "Web Scraping With Python, Second Edition" by Ryan Mitchell
import re
import requests
from bs4 import BeautifulSoup
pages = set()
def get_links(page_url):
global pages
@dideler
dideler / bot.rb
Last active October 23, 2025 16:33
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@Ghosthree3
Ghosthree3 / vpnns.sh
Last active December 1, 2024 07:52
Script for setting up locked down Network Namespaces with a different VPN in each
#!/usr/bin/env bash
set -o pipefail
# This script sets up an additional network namespace for every VPN you wish so that you may
# use any VPN at any time for any program without tunneling everything else on your system.
# Usage:
# Review and edit every line of this script not in a function, then run it as root
# on system startup (yes every reboot), eg. crontab @reboot /root/bin/vpnns.sh
# It is recommended that you run this script manually at least once as you will