Skip to content

Instantly share code, notes, and snippets.

@simonw
simonw / recover_source_code.md
Last active September 14, 2025 04:26
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
@philips
philips / users.md
Last active April 5, 2023 14:17
Kubernetes Third-Party Resource Users
@jessfraz
jessfraz / proposal.md
Created February 3, 2017 00:09
High-Level Security Profile Generator

High-Level Security Profile Generator

(originally from my proposal on moby/moby#17142 (comment) but generic)

The profile would generate artificats of an apparmor profile and seccomp filters.

Obviously doesn't have to be toml since that's super hipster :p

Assumptions

  • no one is going to sit and write out all the syscalls/capabilities their app needs
  • automatic profiling would be super cool but like aa-genprof it is never
@maruks
maruks / erl.el
Created September 22, 2016 22:09
use rebar3 erlang shell in emacs
(setq inferior-erlang-machine "rebar3")
(setq inferior-erlang-machine-options '("shell"))
(setq inferior-erlang-shell-type nil)
# entry point for shard rebalancer
def rebalance_table_shards(relation regclass,
threshold float4 default 0.1,
max_shard_moves int default 1000000,
excluded_shard_list bigint[] default '{}'):
# acquire lock on the relation to prevent concurrent rebalance operations
# acquire lock on the realtion id to prevent schema changes
for colocatedTables in colocatedTableList:
@spacebat
spacebat / critter.lisp
Created April 27, 2016 04:31
CLOS append method combination example
;; An example of append method combination to form a projection of an object's slots
(defclass odour-mixin ()
((odour :initarg :odour :initform nil :reader odour)))
(defclass colour-mixin ()
((colour :initarg :colour :initform nil :reader colour)))
(defclass sound-mixin ()
((sound :initarg :sound :initform nil :reader sound)))
wget http://mirror.sdunix.com/gnu/emacs/emacs-24.5.tar.gz
tar zxvfp emacs-24.5.tar.gz
cd emacs-24.5/
./configure
sudo yum -y install libXpm-devel libjpeg-turbo-devel openjpeg-devel openjpeg2-devel turbojpeg-devel giflib-devel libtiff-devel gnutls-devel libxml2-devel GConf2-devel dbus-devel wxGTK-devel gtk3-devel
./configure
make
sudo make install
@whaison
whaison / UnityCG.cginc
Created March 7, 2016 10:05
Unity5.3.2 UnityCG.cginc ///Applications/Unity/Unity.app/Contents/CGIncludes/UnityCG.cginc
#ifndef UNITY_CG_INCLUDED
#define UNITY_CG_INCLUDED
#define UNITY_PI 3.14159265359f
#include "UnityShaderVariables.cginc"
uniform fixed4 unity_ColorSpaceGrey;
uniform fixed4 unity_ColorSpaceDouble;
uniform half4 unity_ColorSpaceDielectricSpec;
@xavriley
xavriley / README.md
Created February 11, 2016 09:44
Emulating the 2A03 NES sound chip in SuperCollider
@ulve
ulve / install_phoenix.sh
Last active February 1, 2021 19:21
Install Erlang/Elixir/Phoenix on a Raspberry Pi
#!/bin/bash
sudo apt-get update
sudo apt-get --assume-yes install wget
sudo apt-get --assume-yes install libssl-dev
sudo apt-get --assume-yes install ncurses-dev
sudo apt-get --assume-yes install m4
# erlang
wget http://erlang.org/download/otp_src_18.2.tar.gz
tar -xvzf otp_src_18.2.tar.gz
cd otp_src_18.2