Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jak on github.
  • I am jakspalding (https://keybase.io/jakspalding) on keybase.
  • I have a public key whose fingerprint is A8C6 415F 06C9 1289 0DE6 23BE FC07 9412 15EF E767

To claim this, I am signing this object:

@jak
jak / get-metadata.sh
Created July 16, 2020 15:42
Get metadata from GCP instance
curl "http://metadata.google.internal/computeMetadata/v1/instance/attributes/foo" \
-H "Metadata-Flavor: Google"
@jak
jak / hdmi-switch.sh
Created May 21, 2018 08:01
Raspberry Pi HDMI CEC
#!/bin/bash
echo "as" | cec-client -s
04cf6361ef399c7f1ab63679ba32b8717be5bb240716dcf91ba09f41a83ffb9feddbb1baee7cb6b407652c69d082de47d531a9ca9bc8412d9988720aaf7ee5d813
@jak
jak / fedora.md
Last active August 4, 2019 21:09 — forked from jpuskar/fedora.md
Installing Fedora 26 on Macbook Pro Retina 2016

Installing Fedora on Macbook Pro retina

  1. Download Fedora 26 iso, create a usb bootable media
  2. Use diskutil list to figure out which drive is the usb, on macbook pro with 1 hardrive, the usb is /dev/disk2
  3. Umount the disk using diskutil unmountDisk /dev/disk2 or use Mac's Disk Utility (just umount, don't eject, umount removes it from directory structure and eject disconncet it altogether)
  4. Use dd(a low level cp) to write iso content into the usb drive, sudo dd if=~/Downloads/Fedora-Live-Desktop-x86_64-20-1.iso of=/dev/rdisk2 bs=8m, this will take a bit of time, make sure you wait until it's done, additionally compare the size or checksum to make sure all has been copied (not that necessary since if it weren't copied, it'll err at boot time)
  5. Use Disk Utility to shrink Mac's harddrive to create partition for the subsequent fedora installation
  6. Boot to recovery mode (cmd+r) and disable SIP (termina
@jak
jak / promos.rb
Last active June 13, 2017 08:48 — forked from geekygrappler/promos.rb
Pseudo code
## Promocode controller/generate endpoint controller
def generate
if not @promocode.is_valid?
#An array of errors
render json: @promocode.errors
end
if @promocode.save
blah
### Keybase proof
I hereby claim:
* I am jak on github.
* I am jaksp (https://keybase.io/jaksp) on keybase.
* I have a public key whose fingerprint is 2361 AFFB B425 3C4A 48C5 ED63 B705 83EA 69ED 6964
To claim this, I am signing this object:
@jak
jak / gist:70a40c45dd008f5759ff
Created September 1, 2014 08:42
Need a faster hard drive temporarily? Use a RAM disk on OS X
› diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://4194304` # Create a 2GB ramdisk
› rsync -avr Code/ /Volumes/RAM\ Disk/ # Copy your work over
› open /Volumes/RAM\ Disk/ # Open in Finder
# Change ram://XXXX to MB required x 2048 (4194304 = 2048 x 2048)
# 1GB = 2097152
# 2GB = 4194304
# 3GB = 6291456
# 4GB = 8388608
# 8GB = 16777216
#!/usr/bin/env ruby
require 'fileutils'
def guess_name(name)
md = /([\w\.]+)\.(\d{4})\..*/i.match(name)
moviename = md[1].gsub(/\./, ' ')
year = md[2]
"#{moviename} (#{year})"
end
@jak
jak / How to convert P12 to PEM file
Last active December 27, 2015 11:19
How to convert P12 to PEM file
openssl pkcs12 -in myfile.p12 -out newfile.pem -nodes