Skip to content

Instantly share code, notes, and snippets.

✌( ͡ᵔ ͜ʖ ͡ᵔ )✌

Max Ogden maxogden

✌( ͡ᵔ ͜ʖ ͡ᵔ )✌
Block or report user

Report or block maxogden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rgrove / Makefile
Created Jul 30, 2011
Simple Makefile to minify CSS and JS.
View Makefile
# Patterns matching CSS files that should be minified. Files with a -min.css
# suffix will be ignored.
CSS_FILES = $(filter-out %-min.css,$(wildcard \
public/css/*.css \
public/css/**/*.css \
# Patterns matching JS files that should be minified. Files with a -min.js
# suffix will be ignored.
JS_FILES = $(filter-out %-min.js,$(wildcard \
klingtnet /
Last active Feb 18, 2020
How to upgrade [Lenovo] NVMe SSD firmware on Linux

The instructions were tested on a Lenovo X1 Carbon 5th Gen (X1C5) on Arch Linux but should be applicable to other Lenovo models and Linux distributions.

BACKUP YOUR DATA! I created a bootable Ubuntu Image like this:

$ sudo sh -c 'curl --location --silent --fail "" | pv > /dev/<your-usb-drive>'
# note that pv is only there to show progress, it is perfectly fine to redirect curl to the usb drive directly.

then I booted from this drive by pressing F12 on reboot and dumped my NVMe disk to an external hard drive like this:

View gist:4294d5c212a6d2254703

From Fabrice Bellard, with minor name change (umulh):

// return the high 32 bit part of the 64 bit addition of (hi0, lo0) and (hi1, lo1)
Math.iaddh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the 64 bit subtraction of (hi0, lo0) and (hi1, lo1)
Math.isubh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the signed 64 bit product of the 32 bit numbers a and b
theJollySin /
Last active Aug 27, 2019
The smallest lenses adaptable to the Sony a7 (series)

Smallest Lenses Adaptable to the Sony a7

This has been moved to a blog post.

holms /
Last active Mar 15, 2019
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# Add multimedia source
echo "deb wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
daddz / file_queue.rb
Created Apr 1, 2010
a ruby queue based on a file
View file_queue.rb
class FileQueue
def initialize(file_name)
@file_name = file_name
def push(obj)
safe_open('a') do |file|
file.write(obj + "\n")
View gist:389875
import re
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
rahuljiresal / openshift-node-force-domain.js
Last active Jul 22, 2016
This is a middleware for Connect and Express that redirects any requests to a default domain. Based on, modified to work on Openshift platform.
View openshift-node-force-domain.js
Openshift uses haproxy ( as a front proxy to route request to instances of the app.
This proxy does the job of unwrapping https and sets the 'x-forwarded-proto' header.
Because of this, the Node.JS app never sees the actual protocol of the request, unless it checks the presence of this header.
I modified the code written by goloroden ( to check this header instead of ports.
This gist does exactly what his code does, except checks for actual protocol instead of relying on the port for the protocol.
var rewrite = function (route, options) {
options = _.defaults({
jlord /
Last active Feb 9, 2016 — forked from maxogden/
imagemagick script: image background is a larger, blurred copy of itself.
for f in *.jpg; do
convert ./"$f" -gravity center -resize 1137 -extent 1137x640 -blur 0x4 ./finalcat/"new-$f"
convert ./finalcat/"new-$f" -page +248 ./"$f" -flatten ./finalcat/"new-$f"
View gist:8088601
"name" : basename.replace(/^node-/, ''),
"description" : prompt(),
"version" : "0.0.0",
"repository" : {
"type" : "git",
"url" : "git://" + basename + ".git"
"homepage": "" + basename,
"main" : prompt('entry point', 'index.js'),
You can’t perform that action at this time.