Skip to content

Instantly share code, notes, and snippets.

( ͡ᵔ ͜ʖ ͡ᵔ )

Max Ogden maxogden

( ͡ᵔ ͜ʖ ͡ᵔ )
View GitHub Profile
klingtnet /
Last active Aug 8, 2021
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:

zougloub /
Last active Jun 12, 2021
Tiny DVR for RTSP/H264 cameras
#!/usr/bin/env python
# -*- coding:utf-8 vi:noet
# RTSP/H264 simple camera DVR
__author__ = "Jérôme Carretero <>"
__license__ = "MIT"
import sys, io, os, re, time, datetime
import gi
john-science /
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.

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"
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({
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
  • Go to and click Deploy;
  • Choose a name (like test-dat);
  • Wait for deploy to finish and click "View it" (;
  • Click import -> paste JSON -> Copy/Paste example;
  • Do dat clone and cd into folder;
  • Do dat serve and go to localhost:6461;
  • PROBLEM 1: No data;
  • Kill, do echo '{"hello":"world"}'|dat import --json and serve again;
  • Now there's some data, kill and do dat push
  • PROBLEM 2: Nothing changed on Heroku
substack / default.json
Created Dec 22, 2013
my pkginit config
View default.json
"name": basename.replace(/^node-/, ''),
"version": "0.0.0",
"description": (function (cb) {
var fs = require('fs');
var value;
try {
var src = fs.readFileSync('README.markdown', 'utf8');
value = src.split('\n').filter(function (line) {
return /\s+/.test(line)
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'),
holms /
Last active May 25, 2020
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