Skip to content

Instantly share code, notes, and snippets.

View jonneale's full-sized avatar

Jon Neale jonneale

View GitHub Profile
@jonneale
jonneale / gist:4fe7fd2811bb61c251975d542fdc09a9
Created April 29, 2023 14:18
Multiple NICs with ethernet preferred over wifi but both operating
network:
version: 2
renderer: networkd
ethernets:
enp2s0:
addresses: [192.168.15.2/24]
routes:
- to: 0.0.0.0/0
via: 192.168.15.1
metric: 100
@jonneale
jonneale / bind-#-emacs.el
Created September 8, 2014 10:50
Script to bind # to alt-3 on a UK keyboard in emacs
(global-set-key (kbd "s-3") '(lambda () (interactive) (insert "#")))
@jonneale
jonneale / hello-world.rb
Last active December 24, 2015 00:49
ruby hello world
%q{10 10 1000111 00 11 1010010 11 101 10 0010101 0000111 11 01000 01110
11 00 11 00 10 10 01 01 001 11 00 01 11 11 10 01 11 10011
01 00 01 10 00 01 01 11 010 01 11 01 11 11 00 11 11 11010
0010100 110101 00 00 10 01 11 011 01 10 01 11110 01 00 10 00101
11 00 10 10 00 01 01 00 010 11 10 01 11 10 10 11 01
11 00 01 10 11 01 00 0 0 1 00 00 10 00 10 10 00 11011
11 10 001001 101111 11101 0110111 01 01 1110010 01 10 010010 10101 00001}.
gsub(/\D/, "").
to_i(2).
to_s.
@jonneale
jonneale / toggle-fullscreen.el
Created May 29, 2013 10:21
Emacs config to enable full screen toggling bound to a key
(defun toggle-fullscreen ()
"Toggle full screen"
(interactive)
(set-frame-parameter
nil 'fullscreen
(when (not (frame-parameter nil 'fullscreen)) 'fullboth)))
(global-set-key [f7] 'toggle-fullscreen)
@jonneale
jonneale / change-font.el
Created May 29, 2013 10:20
Emacs config to enable the changing of the default font when using the emacs live configuration
(remove-if (lambda (x)
(eq 'font (car x)))
default-frame-alist)
(cond
((and (window-system) (eq system-type 'darwin))
(add-to-list 'default-frame-alist '(font . "Anonymous Pro 16"))))
@jonneale
jonneale / windmove.el
Last active December 17, 2015 20:39
Emacs config for switching buffers using the arrow keys
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
@jonneale
jonneale / beautify-json.el
Last active December 17, 2015 20:39
Emacs config section used to format json files
(defun beautify-json ()
(interactive)
(let ((b (if mark-active (min (point) (mark)) (point-min)))
(e (if mark-active (max (point) (mark)) (point-max))))
(shell-command-on-region b e
"python -mjson.tool" (current-buffer) t)
(esk-indent-buffer)))
@jonneale
jonneale / limit-print-length.el
Created May 29, 2013 10:17
Emacs config to limit nrepl buffer print length
(require 'nrepl)
(defun nrepl-limit-print-length ()
(interactive)
(nrepl-send-string-sync "(set! *print-length* 100)" "clojure.core"))
(defun nrepl-unlimit-print-length ()
(interactive)
(nrepl-send-string-sync "(set! *print-length* nil)" "clojure.core"))
@jonneale
jonneale / dynamo-backups.rb
Last active December 17, 2015 20:39
Dynamo DB backups using the Ruby AWS SDK
require 'aws-sdk'
AWS.config({:access_key_id => "your-access-key-id",
:secret_access_key => "your-secrect-access-key",
:region => "eu-west-1"}) #region is optional
log_uri = "s3n://dynamo-backups/dynamo-backup-resources/logs" #Can be anywhere you like on S3
emr = AWS::EMR.new
job = emr.job_flows.create('dynamo-db-backup', {log_uri: log_uri,