Skip to content

Instantly share code, notes, and snippets.


Michael Smith spinda

View GitHub Profile
simonw /
Last active Oct 26, 2020
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 and

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
anonymous / subresource-integrity
Created Feb 1, 2016
Build a sub-resource integrity string (js | css). Usage: subresource-integrity
View subresource-integrity
if [ ${1: -4} == ".css" ]; then h="<link href=\"//"$1"\""; f=" rel=\"stylesheet\">"; else h="<script src=\"//"$1"\""; f=" type=\"text/javascript\"></script>"; fi; echo $h" integrity=\"sha256-"`curl -s $1 | openssl dgst -sha256 -binary | openssl enc -base64 -A`" sha512-"`curl -s $1 | openssl dgst -sha512 -binary | openssl enc -base64 -A`"\" crossorigin=\"anonymous\""$f
View 0 Himawari Scraper
chrismdp /
Last active Jan 14, 2021
Uploading to S3 in 18 lines of Shell (used to upload builds for
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
kyleturner / Remove Submodule
Created Jan 5, 2012
How to remove a submodule from a Github project
View Remove Submodule
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.