Skip to content

Instantly share code, notes, and snippets.

View omgmog's full-sized avatar
⌨️

Max Glenister omgmog

⌨️
View GitHub Profile
@omgmog
omgmog / partition.sh
Created February 17, 2014 22:46
Isolated partition part of my arch installer script
umount /dev/sda*
parted /dev/sda mklabel gpt
cgpt create -z /dev/sda
cgpt create /dev/sda
cgpt add -i 1 -t kernel -b 8192 -s 32768 -l U-Boot -S 1 -T 5 -P 10 /dev/sda
cgpt add -i 2 -t data -b 40960 -s 32768 -l Kernel /dev/sda
cgpt add -i 12 -t data -b 73728 -s 32768 -l Script /dev/sda
PARTSIZE=`cgpt show /dev/sda | grep 'Sec GPT table' | egrep -o '[0-9]+' | head -n 1`
cgpt add -i 3 -t data -b 106496 -s `expr ${PARTSIZE} - 106496` -l Root /dev/sda
partprobe /dev/sda
@omgmog
omgmog / lcd.js
Created June 15, 2014 13:12
Output basic weather to LCD on Arduino using Johnny-five
/*
wiring diagram: https://github.com/rwaldron/johnny-five/raw/master/docs/breadboard/lcd.png
usage:
npm install feedparser johnny-five request
node lcd.js
*/
var five = require("johnny-five"),
#!/bin/bash
# usage:
# cd Resources
# sh check_dead.sh
for file in *.md; do
echo "====== Reading file: ${file} ======"
while read line; do
url=$(echo "$line" | sed s/.*\(// | sed s/\)// | sed s/^##.*//)
@omgmog
omgmog / patch.diff
Created October 31, 2014 16:32
diff to test partx
diff --git a/install.sh b/install.sh
index 63c6661..40865e3 100644
--- a/install.sh
+++ b/install.sh
@@ -30,14 +30,14 @@ UBOOTFILE="nv_uboot-spring.kpart.gz"
if [ $DEVICE = $EMMC ]; then
# for eMMC we need to get some things before we can partition
echo -e "\n[archlinuxfr]\nSigLevel = Never\nServer = http://repo.archlinux.fr/arm\n" >> /etc/pacman.conf
- pacman -Syyu packer devtools-alarm base-devel git libyaml parted dosfstools cgpt parted
+ pacman -Syyu packer devtools-alarm base-devel git libyaml dosfstools cgpt
@omgmog
omgmog / generate-signed-kernel.sh
Last active August 29, 2015 14:10
For generating a signed kernel to use Arch on a Chromebook
#!/bin/sh
set -e
DEV="/dev/mmcblk0"
DEV_MNT="/tmp/emmc"
P1="${DEV}p1"
P3="${DEV}p3"
PP="$(pwd)/"
KEYS_OUT="${PP}devkeys"
@omgmog
omgmog / recovery.conf
Created December 7, 2014 21:19
SPRING recovery.conf
recovery_tool_version=0.9.2
recovery_tool_linux_version=0.9.2
recovery_tool_update=
name=HP Chromebook 11
version=6158.70.0
desc=HP Chromebook 11
channel=stable-channel
hwidmatch=^SPRING .*
hwid=SPRING AAAB-32H
@omgmog
omgmog / color-difference.scss
Last active August 29, 2015 14:13
Display h/s/l difference between colors in a list of colors
@mixin determine_color_difference($first, $second) {
$hue: hue($first) - hue($second);
$sat: saturation($first) - saturation($second);
$lightness: lightness($first) - lightness($second);
@debug '------------------';
@debug 'First: #{$first}';
@debug 'Second: #{$second}';
@debug 'Hue difference: #{$hue}';
@debug 'Saturation difference: #{$sat}';

# nbsp space

normal space

# actual nbsp space

@omgmog
omgmog / meancpuspeed
Created February 27, 2015 18:21
Output the mean speed in Mhz of all cpu cores
#!/bin/sh
cat /proc/cpuinfo | grep MHz | awk '{ total += $4; count++} END { print total/count }'
@omgmog
omgmog / .bashrc
Created March 2, 2015 12:01
Better bash open
#!/bin/bash
# This just wraps the bash `open` command to allow it to open directories using `nautilus`, just as `open` on Mac OS uses Finder.app.
open(){
if [[ -d "${1}" ]]; then
nautilus $1
elif [[ -f "${1}" ]]; then
\open $1
else