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
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
klingtnet / how-to-upgrade-nvmw-ssd-firmware-on-linux.md
Last active Feb 18, 2020
How to upgrade [Lenovo] NVMe SSD firmware on Linux
View how-to-upgrade-nvmw-ssd-firmware-on-linux.md

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 "http://releases.ubuntu.com/18.04/ubuntu-18.04.1-desktop-amd64.iso" | 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
theJollySin / smallest_lenses_for_sony_a7.md
Last active Aug 27, 2019
The smallest lenses adaptable to the Sony a7 (series)
View smallest_lenses_for_sony_a7.md

Smallest Lenses Adaptable to the Sony a7

This has been moved to a blog post.

@holms
holms / full-ffmpeg.sh
Last active Mar 15, 2019
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
View full-ffmpeg.sh
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org 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
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
end
def push(obj)
safe_open('a') do |file|
file.write(obj + "\n")
end
View gist:389875
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
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
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 https://github.com/goloroden/node-force-domain, modified to work on Openshift platform.
View openshift-node-force-domain.js
/*
Openshift uses haproxy (haproxy.org) 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 (https://github.com/goloroden/node-force-domain) 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
jlord / index.sh
Last active Feb 9, 2016 — forked from maxogden/index.sh
imagemagick script: image background is a larger, blurred copy of itself.
View index.sh
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"
done
View gist:8088601
{
"name" : basename.replace(/^node-/, ''),
"description" : prompt(),
"version" : "0.0.0",
"repository" : {
"type" : "git",
"url" : "git://github.com/juliangruber/" + basename + ".git"
},
"homepage": "https://github.com/juliangruber/" + basename,
"main" : prompt('entry point', 'index.js'),
You can’t perform that action at this time.