Skip to content

Instantly share code, notes, and snippets.

@karthiks
karthiks / ollama-commands-reference.sh
Last active December 18, 2025 02:06
Ollama Commands Cheat Sheet
##### Server Management #####
# Start ollama server using commands - start or serve
ollama start
ollama serve
# Check if server is running
ollama ps
ollama ps --verbose # Check system resources
@moyaldror
moyaldror / remove_git_submodule.sh
Last active August 3, 2021 04:51
Complete remove of git submoule
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <submodule full name>"
exit 1
fi
MODULE_NAME=$1
MODULE_NAME_FOR_SED=$(echo $MODULE_NAME | sed -e 's/\//\\\//g')
@lakshin
lakshin / multirequire.js
Last active November 24, 2017 18:13
Use multiple package versions in one node project
//server.js
const http = require('http');
//const niv = require('npm-install-version');
const chalkv2 = require('chalk');
const multiRequire = require('./multiRequire');
const chalkv1 = multiRequire().multiRequire('chalk','1.0.0');
console.log('chalk v1'+chalkv1.blue(chalkv1.version));
console.log('chalk v2'+chalkv2.blue(chalkv2.version));
const hostname = '127.0.0.1';
@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
// reducer.js
let initialState = 0;
function reducer (state=initialState, action) {
switch(action.type){
case 'INCREMENT_COUNT':
return state + 1;
default:
return state
}
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash

Follow the dirty money

A shady Internet business has been discovered.

The website has been made public by a whistle blower. We have enough evidence about the dirty deals they did. But to charge them we need to get hands on precise numbers about the transactions that happened on their platform.

Unfortunately no record of the transactions could be seized so far. The only hint we have is this one transaction:

@wojteklu
wojteklu / clean_code.md
Last active December 19, 2025 15:34
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jaredhowland
jaredhowland / clear-font-cache.md
Last active October 18, 2025 20:23
Clear Mac OS X Font Caches
@adam-p
adam-p / Local PR test and merge.md
Last active September 18, 2025 16:14
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37