As configured in my dotfiles.
start new:
tmux
start new with session name:
# ADD this to Rakefile and run it by issuing rake roles.to_json | |
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles")) | |
namespace :roles do | |
desc "Convert ruby roles from ruby to json, creating/overwriting json files." | |
task :to_json do | |
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file| | |
role = Chef::Role.new | |
role.from_file(rb_file) | |
json_file = rb_file.sub(/\.rb$/,'.json') |
As configured in my dotfiles.
start new:
tmux
start new with session name:
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
(require 'url) | |
(require 'json) | |
(url-retrieve "http://api.soundcloud.com/users/corecode/favorites.json?client_id=YOUR_CLIENT_ID" | |
(lambda (status) | |
(message "status: %s" (json-encode status)) | |
(search-forward "\n\n") | |
(let* ((json (buffer-substring (point) (point-max))) | |
(json-object-type 'plist) | |
(json-array-type 'list) |
(require 'cl) | |
(defun parse-csv-file (file) | |
(interactive | |
(list (read-file-name "CSV file: "))) | |
(let ((buf (find-file-noselect file)) | |
(result nil)) | |
(with-current-buffer buf | |
(goto-char (point-min)) | |
(while (not (eobp)) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
# generate server.xml with the following command: | |
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
# run as follows: | |
# python simple-https-server.py | |
# then in your browser, visit: | |
# https://localhost:4443 | |
import BaseHTTPServer, SimpleHTTPServer | |
import ssl |
When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.
This is enabled by adding the
ForwardAgent yes
option to any of your Host
entries in ~/.ssh/config
(or alternatively with the -A
option). Don't set this option in a wildcard Host *
section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.