Skip to content

Instantly share code, notes, and snippets.

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active December 16, 2024 17:51
Hyperlinks in Terminal Emulators
@NeuroWinter
NeuroWinter / ffmpeg cheatsheet for glitching
Last active December 18, 2024 06:18
ffmpeg cheatsheet for glitching
FFMPEG '-i', file, '-c:v', 'libopenjpeg', "jpeg2000\\" + name + ".jp2"\
Convert image to jpeg2000
ffmpeg -i in.png -c:v libopenjpeg out.jp2
Hex Edit out.jp2
ffmpeg -i in.jp2 -c:v png out.png
General Edit
ffmpeg -i input.avi -c:v mpeg2video -g 999 -q:v 1 output.avi
*edit in avidemux/whatever*
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@gaearon
gaearon / slim-redux.js
Last active December 3, 2024 06:34
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@jcpst
jcpst / mh.zsh-theme
Created August 19, 2015 17:31
Oh My ZSH prompt with git/node/docker-machine awareness
# mh theme
# Modified by Joseph Post
# features:
# path is autoshortened to ~25 characters
# displays git status, short SHA, and clean/dirty
# displays node/npm versions
# displays docker machine name if active.
# prompt
@mauvm
mauvm / gist:5de07085f3b51e117378
Created July 26, 2015 11:57
An "envsubst" alternative for replacing env variables in NGinX site configurations (for using it with Docker)
#!/bin/bash
# NOTE: Brackets are not supported and '$' in values will break the script.
mkdir /etc/nginx/sites-enabled 2> /dev/null
for file in /etc/nginx/sites-available/*.conf
do
TPL=$(cat $file)
for row in $(env)
do
#ifndef BIQUAD_H
#define BIQUAD_H
#include <math.h>
#include <stdint.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
@corywheeler
corywheeler / mocha-before-and-beforeEach-lifecycles.js
Created December 12, 2014 17:14
Show the order of execution of mocha's before and beforeEach hooks for each describe and each test
describe('highest level describe', function () {
before(function() {
console.log('This is the highest level before')
})
beforeEach(function() {
console.log('This is the highest level beforeEach')
})
it('This is the first highest level test', function() {
@shuxiang
shuxiang / sqla.py
Last active September 7, 2022 10:34
sqlalchemy get model by name and get model by tablename
from flask.ext.sqlalchemy import SQLAlchemy
def get_model(self, name):
return self.Model._decl_class_registry.get(name, None)
SQLAlchemy.get_model = get_model
def get_model_by_tablename(self, tablename):
for c in self.Model._decl_class_registry.values():
if hasattr(c, '__tablename__') and c.__tablename__ == tablename:
return c
@mattes
mattes / check.go
Last active October 11, 2024 16:22
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}