Skip to content

Instantly share code, notes, and snippets.

View tnwei's full-sized avatar

tnwei

View GitHub Profile
@PHPirates
PHPirates / git-bundles.md
Last active January 10, 2025 14:26
How to use git bundles

Let machine M be the Main machine with the repo, and A the Auxiliary machine which wants to help out.

First time setup

  1. Machine M creates bundle with complete repo:
git bundle create repo.bundle HEAD master
  1. M sends repo.bundle to A.
  2. A clones repo from bundle:
@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@clbarnes
clbarnes / ode_constraints.py
Last active May 14, 2021 12:33
Decorator to wrap a derivative function in order to constrain the output of an ODE solver
"""
Note that this constrains the dependent variable from going *any further* past the constraints.
The ODE will still treat it as if it were at the value of the constraint,
and with a small step size any problems should be minimal,
but you may still have slightly out-of-range numbers in your solution.
"""
import numpy as np
from functools import wraps
@staringispolite
staringispolite / asciiputsonglasses
Last active January 20, 2025 07:52
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
@hmartiro
hmartiro / zeromq-vs-redis.md
Last active December 16, 2024 04:02
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@jakevdp
jakevdp / discrete_cmap.py
Last active January 12, 2025 13:24
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
@eamonnbell
eamonnbell / in-c.py
Last active June 15, 2021 15:59
Generate a performance of Terry Riley's In C
import music21
import itertools
from random import randint
MIN_REPETITIONS = 4
MAX_REPETITIONS = 10
NUMBER_OF_PARTS = 10
motives = ['e4 e e', 'e8 f8 e4', 'r8 e f e', 'r8 e f g', 'e8 f g r',
@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html