Skip to content

Instantly share code, notes, and snippets.

@obeone
obeone / README.md
Last active February 28, 2026 03:08
Ollama ZSH Completion

ZSH Completion for Ollama (ollama command)

This ZSH completion script enhances your command line interface by providing auto-completion for the ollama command, part of the Ollama suite. It supports all subcommands and their options, significantly improving efficiency and reducing the need for memorizing syntax.

Installation

  1. Download the Completion Script
    You can download the _ollama script directly using the following command:
@elnygren
elnygren / Dockerfile
Last active April 5, 2025 21:35
Nginx+Docker with autoreload on config changes for local development
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf
RUN apt-get update && apt-get install -y inotify-tools
COPY watcher.sh /watcher.sh
RUN chmod +x /watcher.sh
CMD ["/watcher.sh"]
@vikyd
vikyd / getVal.sh
Last active September 12, 2018 03:07
Shell: get value from key=value file with value trim and key trim, and allow `=` ` space` in value
#!/bin/sh
# These vars and func are used to get value from a key=value file
# It will also trim the leading and trailing whitespace, tab
# Key with space after or before is supported
getVal(){
# cut `=` in val: https://unix.stackexchange.com/a/53315/207518
# grep: allow space after or before of key
# awk trim space after and before of value: https://unix.stackexchange.com/a/205854/207518
declare val=$(cat ${1} | grep "^ *${2} *=" | cut -d '=' -f 2- | awk '{$1=$1}1')
@vikyd
vikyd / getVal.bat
Last active September 12, 2018 03:08
Windows Batch: get value from key=value file with value trim, not allow `=` in value, not allow space after or before the key
@ECHO OFF
REM https://stackoverflow.com/a/9681923/2752670
SET myKey=abc2
SET myFile=keyval.txt
CALL :GetVal %myFile% %myKey% myVal
REM is string empty https://stackoverflow.com/a/2541820/2752670
IF [%myVal%] == [] (
ECHO no key: %myKey% in file: %myFile%
) ELSE (
@mahasak
mahasak / postman-bigint.js
Last active April 30, 2024 17:12
Postman Test Runner BigInt fix
var BigNumber,
isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
mathceil = Math.ceil,
mathfloor = Math.floor,
notBool = ' not a boolean or binary digit',
roundingMode = 'rounding mode',
tooManyDigits = 'number type has more than 15 significant digits',
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',
BASE = 1e14,
LOG_BASE = 14,
@alswl
alswl / hosts
Last active August 24, 2025 12:53
(deprecated, I bought xiaomi VIP)hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
@matthewjberger
matthewjberger / instructions.md
Last active March 9, 2026 18:36
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@mdonkers
mdonkers / server.py
Last active January 21, 2026 14:23
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@jesselucas
jesselucas / changroup.go
Last active October 31, 2025 13:49
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size
@vcabbage
vcabbage / command-timeout-pre17.go
Last active May 20, 2021 07:33
Command timeout without context
package main
import (
"bytes"
"fmt"
"os/exec"
"time"
)
func main() {