Skip to content

Instantly share code, notes, and snippets.

@illucent
illucent / recover_source_code.md
Created March 12, 2017 19:31 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@illucent
illucent / serviceworker.js
Created March 8, 2017 23:21 — forked from gauntface/serviceworker.js
Notification Badge Demo
self.addEventListener('push', function(event) {
event.waitUntil(
self.registration.showNotification(
'Hello', {
body: 'Thanks for sending this push msg.',
icon: './images/icon-192x192.png',
badge: './images/icon-72x72.png'
})
);
});
@illucent
illucent / codegolf.md
Created February 24, 2017 20:39 — forked from xem/codegolf.md
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, ...

(For more info and other projects, visit http://xem.github.io and https://github.com/xem / https://github.com/codegolf)


https://github.com/xem/miniConwaySerpinski (188b Game of Life tweak to produce a Serpinski triangle)

@illucent
illucent / pure_js_copy_to_clipboard
Created February 19, 2017 22:44
Pure JavaScript copy to clipboard function
// https://www.samclarke.com/js-copy-to-clipboard-function/
//
window.copyToClipboard = function (node) {
// Skip IE < 9 which uses TextRange instead of Range
if (!window.getSelection) {
return false;
}
var doc = document;
var result = false;
@illucent
illucent / Full Stack JavaScript.md
Created February 14, 2017 19:28 — forked from royshouvik/Full Stack JavaScript.md
Learn Full Stack JavaScript Web Development for FREE using resources like YouTube, Udacity and NodeSchool
@illucent
illucent / noise.sh
Created January 28, 2017 16:10 — forked from xguse/noise.sh
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-10-04
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@illucent
illucent / reltime.py
Created January 27, 2017 11:05 — forked from deontologician/reltime.py
Relative datetimes in python
def reltime(date, compare_to=None, at='@'):
r'''Takes a datetime and returns a relative representation of the
time.
:param date: The date to render relatively
:param compare_to: what to compare the date to. Defaults to datetime.now()
:param at: date/time separator. defaults to "@". "at" is also reasonable.
>>> from datetime import datetime, timedelta
>>> today = datetime(2050, 9, 2, 15, 00)
>>> earlier = datetime(2050, 9, 2, 12)
@illucent
illucent / vimeo.com.ffpreset
Created January 26, 2017 13:57 — forked from johnjohndoe/vimeo.com.ffpreset
FFmpeg settings for vimeo.com
// FFmpeg settings for vimeo.com
// =============================
// Trying to find the best settings for encoding videos as described here: http://vimeo.com/help/compression
//
// Input file: MTS
// Video: H264, 1920x1080, 50fps
// Audio: A52 Audio (aka AC3), Stereo, 48kHz, 256kbps
ffmpeg -i input.mts -vcodec libx264 -acodec aac -strict experimental -vpre hq -s hd720 -b 5000k -ab 320k -r 25 -g 25 -threads 0 output.mp4
@illucent
illucent / boilerplate.html
Created January 23, 2017 16:21 — forked from haydenbleasel/boilerplate.html
A powerful HTML5 boilerplate for the modern web.
<!-- HTML5 Doctype. Remember to delete these comments (Quirks Mode). -->
<!doctype html>
<!-- HTML tag -->
<html lang="">
<!-- Let's get started -->
<head>
<!-- Document settings and metadata -->
brew install Qt4
brew install openssl
brew install cmake
git clone https://github.com/PySide/pyside-setup.git --recurse-submodules
cd pyside-setup
# The following must be executed in a bash shell
python setup.py bdist_wheel --ignore-git --qmake=/usr/local/Cellar/qt/4.8.7_2/bin/qmake --openssl=/usr/local/Cellar/openssl/1.0.2h_1/bin/openssl --cmake=/usr/local/Cellar/cmake/3.5.2/bin/cmake