Skip to content

Instantly share code, notes, and snippets.

View danslimmon's full-sized avatar

Dan Slimmon danslimmon

View GitHub Profile
[myapp]
username = app_user
password = hunter2
[myapp]
username = {{ pillar['myapp']['username'] }}
password = {{ pillar['myapp']['password'] }}
dan@george:/tmp/secrets$ echo "nuclear launch code: SashaMalia44" > launchcode.txt
dan@george:/tmp/secrets$ blackbox_register_new_file launchcode.txt
========== PLAINFILE launchcode.txt
========== ENCRYPTED launchcode.txt.gpg
========== Importing keychain: START
gpg: Total number processed: 1
gpg: unchanged: 1
========== Importing keychain: DONE
========== Encrypting: launchcode.txt
========== Encrypting: DONE
dan@george:/tmp/secrets$ blackbox_addadmin dan@danslimmon.com
gpg: /private/tmp/secrets/keyrings/live/trustdb.gpg: trustdb created
gpg: key A9FD8CCF: public key "Dan Slimmon " imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
NEXT STEP: You need to manually check these in:
git commit -m'NEW ADMIN: dan@danslimmon.com' keyrings/live/pubring.gpg keyrings/live/trustdb.gpg keyrings/live/blackbox-admins.txt
dan@george:/tmp/secrets$ git commit -m'NEW ADMIN: dan@danslimmon.com' keyrings/live/pubring.gpg keyrings/live/trustdb.gpg keyrings/live/blackbox-admins.txt
[master (root-commit) 94108f6] NEW ADMIN: dan@danslimmon.com
3 files changed, 2 insertions(+)
dan@george:/tmp/secrets$ blackbox_initialize
Enable blackbox for this git repo? (yes/no) yes
VCS_TYPE: git
NEXT STEP: You need to manually check these in:
git commit -m'INITIALIZE BLACKBOX' keyrings /private/tmp/secrets/.gitignore
dan@george:/tmp/secrets$ git commit -m'INITIALIZE BLACKBOX' keyrings /private/tmp/secrets/.gitignore
[master 695d29a] INITIALIZE BLACKBOX
2 files changed, 3 insertions(+)
create mode 100644 .gitignore
create mode 100644 keyrings/live/blackbox-files.txt
velvet underground – velvet underground and nico – "venus in furs"
robyn – body talk – "dancehall queen"
yo la tengo – i can hear the heart beating as one – "green arrow"
guided by voices – bee thousand – "her psychology today"
flaming lips – butts taste metallic – "brainville"
neko case – middle cyclone – "never turn your back on mother earth"
beach boys – pet sounds – "sloop john b"
pixies – surfer rosa – "i'm amazed"
shins – chutes too narrow – "gone for good"
talking heads – stop making sense – "swamp"
danslimmon@salt-server:~$ sudo salt-cloud -p saltify-profile minionname
[INFO ] salt-cloud starting
[INFO ] Starting new HTTP connection (1): 169.254.169.254
[INFO ] Starting new HTTP connection (1): 169.254.169.254
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[INFO ] Starting new HTTP connection (1): 169.254.169.254
[INFO ] Starting new HTTP connection (1): 169.254.169.254
[INFO ] Starting new HTTPS connection (1): ec2.us-west-2.amazonaws.com
[INFO ] Starting new HTTP connection (1): 169.254.169.254
[INFO ] Starting new HTTP connection (1): 169.254.169.254
Binary repr of 1.0:
0 01111111111 0000000000000000000000000000000000000000000000000000
Binary repr of 2.0:
0 10000000000 0000000000000000000000000000000000000000000000000000
Binary repr of 3.0:
0 10000000000 1000000000000000000000000000000000000000000000000000
Binary repr of 5.0:
0 10000000001 0100000000000000000000000000000000000000000000000000
Binary repr of 3.0010:
0 10000000000 1000000000100000110001001001101110100101111000110101

Part 1

You can think of light as a particle or a wave.

In the wave representation, it's a fluctuation in an electromagnetic field perpendicular to the direction of propagation. The amplitude of that fluctuation – the size of the maximum electric field at a particular point in the wave – varies according to an envelope that's kinda shaped like a bell curve.

In the particle representation, the photon's position is basically the point where the wave's amplitude is highest. Where the envelope is widest.

Picture

@danslimmon
danslimmon / π.py
Created January 5, 2016 22:44
Couldn't find an accurate estimate of π anywhere, so I decided to Monte Carlo it
#!/usr/bin/python
import random
N_REP = 9999999
c = 0
for i in range(N_REP):
x, y = (random.random()-.5, random.random()-.5)
if (x*x+y*y)**.5 < .5:
c += 1