I hereby claim:
- I am rickycook on github.
- I am rickycook (https://keybase.io/rickycook) on keybase.
- I have a public key whose fingerprint is 1255 FA8D 8DE3 0534 D431 4564 79D6 68B9 12F3 6735
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Uses the rsync change summary to figure out how many things changed, and uses that | |
# to tell Ansible if something changed or not | |
- name: sync hieradata | |
shell: rsync --delete -ri "/tmp/repo/hieradata" "/etc/puppet/hieradata" | awk '{print $1}' | grep -vE '..\.\..\.\.\.\.' | wc -l | |
register: hieradata_changes | |
changed_when: "hieradata_changes.stdout|int != 0" |
""" | |
Test the "latency" of different ways to trigger multiprocessing start. | |
This will essentially create a multiprocessing `Process` object and measure the | |
time from when we tell that process to start processing (not necessarily | |
`Process.start`) until the time that the process picks up the request to start. | |
This is done in several ways: | |
- Without a blocker: the time is recorded, then the `Process.start` method |
# Find files in the current directory that do not contain a '.' | |
(item for sublist in ((os.path.join(r,f) for f in fs if '.' not in f) for r, _, fs in os.walk('.')) for item in sublist if os.path.isfile(item)) | |
# Add '.log' to the end of any file that has no extension. Probably easier with `rename` command :| | |
[shutil.move(src, '%s.log' % src) for src in (item for sublist in ((os.path.join(r,f) for f in fs if '.' not in f) for r, _, fs in os.walk('.')) for item in sublist if os.path.isfile(item))] |
#!/bin/bash | |
remote_name="$1" | |
: ${remote_name:="origin"} | |
git_root="$(cd "$(git rev-parse --show-toplevel)"; pwd)/" | |
rsync_dest=$(git remote -v | grep "^$remote_name\s.*\(push\)" | awk '{print $2}') | |
echo "Remote name: $remote_name" | |
echo "Repo root: $git_root" | |
echo "Repo dest: $rsync_dest" |
(function($, c) { | |
var rootObject = $('table:visible:contains("Create Tag")').first(), | |
createButton = $('button:contains("Create Tag")', rootObject).first(), | |
inputsKey = $('input[name="key"]', rootObject), | |
inputsValue = $('input[name="value"]', rootObject), | |
tags = $.parseJSON(prompt('JSON tag values')), | |
tagsKeys = Object.keys(tags); | |
if (tagsKeys.length > inputsKey.length) { | |
for (var i = 0; i < tagsKeys.length - inputsKey.length; i++) { |
LastPass adds category fields for everything; even things without categories! It will add a "grouping: (none)" for these passwords. This script takes a data.1pif
export file (File -> Export -> All Items in 1password) and strip out this useless extra data. When done, import the data-out.1pif
, and the fields will be removed. Data is updated in-place in 1password, so there will be no duplicates or anything nasty like that (thanks 1password!)
#cloud-config | |
coreos: | |
units: | |
- name: 00-eth0.network | |
runtime: true | |
content: | | |
[Match] | |
Name=eth0 | |
[Network] |
Imagine you're messing around in a container, and you install some stuff, add some config, and now it's time to load up your client and check it out! Oh wait, you forgot to forward ports when you created the container! Fear not, all is not lost, for in the world of pipes, and streams, there is always a way to do something disgusting.
Example Dockerfile included will install Nginx, and socat in a container, and make Nginx run in foreground mode. To build, and run:
TL;DR tunnels a socket from multiple hosts to a single host, creating sockets on the remote end automatically and encrypting all traffic over the network.
Creates a server that listens on 4433. All traffic is encrypted with OpenSSL using both client and server keys. When a client connects, a new random UNIX socket is created on the host and waits for connection. When an application connects to the socket on the server, it can talk to the socket on the client as if it were a local socket.
In this case, we're using a Docker socket, but this is easy to change.
$ ./server.sh server