Skip to content

Instantly share code, notes, and snippets.

@samjsharpe
samjsharpe / extract.py
Created February 11, 2023 22:11
extract images from IRG file
from re import A
from PIL import Image, ImageDraw
width = 180
height = 240
diff_start=0x80
first_array_start = diff_start
first_array_end = diff_start + width * height - 1
second_array_start = diff_start + width * height
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@aolkin
aolkin / Melexis MLX90614.md
Last active April 1, 2024 02:13
Quick library to read from the MLX90614 with python on a Raspberry Pi, using the Adafruit_I2C library

Note that the following code must be run at every boot for this to work, because of the repeated-start requirement:

sudo su -c 'echo "Y" > /sys/module/i2c_bcm2708/parameters/combined'

@miek
miek / GSG case
Last active May 29, 2022 16:57
Unofficial case for YARD Stick One and Ubertooth One from Great Scott Gadgets - http://greatscottgadgets.com/

Reverse proxy over 3G modem (draft)

We will explain how to configure a cubieboard running debian as a reverese proxy. The modules that will be used are wvdial and autossh

Credits goes to:

1. http://blog.rootshell.be/2015/02/19/my-little-pwnie-box/
2. https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd
@bmaupin
bmaupin / gist:1b59abbf30406ed1eb82
Last active April 2, 2021 15:13
Parse installed packages from /var/log/apt/history.log
import re
history_snippet = '''Start-Date: 2014-08-25 12:52:37
Commandline: apt-get install -y openjdk-6-jdk openjdk-7-jdk icedtea-7-plugin
Install: openjdk-6-jre-lib:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), icedtea-netx-common:amd64 (1.5-1ubuntu1, automatic), openjdk-6-jdk:amd64 (6b32-1.13.4-4ubuntu0.14.04.1), libxcb1-dev:amd64 (1.10-2ubuntu1, automatic), ttf-dejavu-extra:amd64 (2.34-1ubuntu1, automatic), icedtea-6-jre-cacao:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), icedtea-7-plugin:amd64 (1.5-1ubuntu1), libxau-dev:amd64 (1.0.8-1, automatic), openjdk-6-jre-headless:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), x11proto-core-dev:amd64 (7.0.24-1, automatic), libxt-dev:amd64 (1.1.4-1, automatic), openjdk-7-jdk:amd64 (7u65-2.5.1-4ubuntu1~0.14.04.1), libx11-dev:amd64 (1.6.2-1ubuntu2, automatic), x11proto-kb-dev:amd64 (1.0.6-2, automatic), openjdk-6-jre:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), xtrans-dev:amd64 (1.3.2-1, automatic), libxdmcp-dev:amd64 (1.1.1-1, automatic), icedtea-netx:a
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi