Skip to content

Instantly share code, notes, and snippets.

View yanshiyason's full-sized avatar

Shiyason yanshiyason

View GitHub Profile

Basic

import code; code.interact(local=locals())

Advanced

IPython with embed()

That’s one of the real strengths of Docker: the ability to go back to a previous commit. The secret is simply to docker tag the image you want.
Here’s an example. In this example, I first installed ping, then committed, then installed curl, and committed that. Then I rolled back the image to contain only ping:
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
@nicholasknight
nicholasknight / adv2notes.md
Last active January 2, 2024 02:39
Kinesis Advantage 2 notes

(NOTE: Current and future versions of this and any other Advantage 2-related things I post will be at https://github.com/nicholasknight/adv2keyboard)

I received my Advantage 2 today. There's no full manual yet, even though keyboards are apparently arriving (hint, hint, Kinesis). The quick start guide leaves out the "power user mode", and there are some other quirks.

Update: A manual has been posted at http://www.kinesis-ergo.com/advantage2-resources/

It includes a dictionary for the key maps, but I know it leaves at least one possible key undocumented: it does not list f14, but I have successfully mapped my scrollock to f14 regardless.

It also mentions a firmware version (1.0.18) that doesn't seem to be available yet, with a new feature (status report playback speed).

@jtdp
jtdp / gist:5443498
Last active January 24, 2024 08:59
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
@zircote
zircote / ssh.sh
Created September 26, 2011 21:45
Convert a AWS PEM into a ssh pub key
ssh-keygen -y -f private_key1.pem > public_key1.pub
@miki725
miki725 / .bash_prompt.sh
Last active April 5, 2024 00:04
Custom bash prompt which displays: (virtualenv) user:/path (git-branch)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.