Skip to content

Instantly share code, notes, and snippets.

View jsrn's full-sized avatar
🌡️
being cool

James jsrn

🌡️
being cool
View GitHub Profile
@jsrn
jsrn / shortcuts.md
Last active October 8, 2020 09:03
VSCode Keyboard Navigation

Move cursor to end of word

option + left/right

Move arrow to end of line

command + left/right
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsrn
jsrn / bottles.rb
Created March 30, 2017 16:47
bottles
class Bottles
def verse(verse_number)
return final_verse if verse_number == 1
return empty_verse if verse_number == 0
normal_verse(verse_number)
end
def verses(max, min)
max.downto(min).map { |verse| Bottles.new.verse(verse) }.join("\n")
end
@jsrn
jsrn / balancing.rb
Last active January 13, 2017 11:03
The World's Most Basic Load Balancing
URLS = ["https://a.b.c.d"]
PORTS = [80, 81, 82, 83, 84]
def random_endpoint
"#{URLS.sample}:#{PORTS.sample}"
end
@jsrn
jsrn / screen-cheatsheet.md
Last active August 29, 2015 14:22
screen cheatsheet

Starting Screen

$ screen

Reattaching

screen -r will allow you to reattach to a screen.

Commands

@jsrn
jsrn / array.rb
Last active August 29, 2015 14:19
dat monkeypatch
class Array
def middle
if self.length % 2 == 1
self[length / 2]
else
[self[length/2 - 1], self[length/2]]
end
end
end
@jsrn
jsrn / Vagrantfile
Created February 26, 2015 00:49
Deploying Dionaea with Vagrant and Salt
Vagrant.configure("2") do |config|
## Choose your base box
config.vm.box = "hashicorp/precise32"
## For masterless, mount your salt file root
config.vm.synced_folder "salt/roots/", "/srv/salt/"
## Use all the defaults:
config.vm.provision :salt do |kdsalt|
@jsrn
jsrn / keybase.md
Created September 27, 2014 14:31
keybase.md

Keybase proof

I hereby claim:

  • I am jsrn on github.
  • I am jsrn (https://keybase.io/jsrn) on keybase.
  • I have a public key whose fingerprint is 69C3 86EA 1B11 2FDE C5E6 EBC2 DC63 2521 B28E AADD

To claim this, I am signing this object: