Skip to content

Instantly share code, notes, and snippets.

@teancom
teancom / bumpme
Last active January 17, 2018 23:33
Wed Jan 17 23:32:57 UTC 2018
@teancom
teancom / ssh-reagent.sh
Created November 29, 2017 17:06
SSH reagent for use within tmux, screen, etc.
ssh-reagent () {
for agent in /tmp/ssh-*/agent.*; do
export SSH_AUTH_SOCK=$agent
if ssh-add -l 2>&1 > /dev/null; then
echo Found working SSH Agent:
ssh-add -l
return
fi
done
echo Cannot find ssh agent - maybe you should reconnect and forward it?
@teancom
teancom / gist:0d80c417b49cdc926a1c381b195fa522
Created October 18, 2017 20:32
console.app output every time the screen pauses
fault 14:30:05.230227 -0600 kernel virtual IOReturn IOAccelEventMachine2::waitForStamp(int32_t, stamp_t, stamp_t *): initial wait for 1 second expired. Continue wait for 4 seconds. stamp 8060894 (gpu_stamp=8060893)
fault 14:30:09.230120 -0600 kernel virtual IOReturn IOAccelEventMachine2::waitForStamp(int32_t, stamp_t, stamp_t *): timeout waiting for IntelAccelerator stamp 8060894 (gpu_stamp=8060893)
fault 14:30:09.230137 -0600 kernel void IOAccelEventMachine2::handleFinishChannelRestart(IOReturn, int32_t, uint32_t) - Setting restart type to 4
fault 14:30:09.230141 -0600 kernel void IOAccelEventMachine2::handleFinishChannelRestart(IOReturn, int32_t, uint32_t): GPURestartDequeued stampIdx=4 type=4 fromWhere=1 waitingOnIdx=4
fault 14:30:09.230190 -0600 kernel void IOAccelEventMachine2::restart_channel(): GPURestartSkipped stampIdx=4 type=4
fault 14:30:09.230194 -0600 kernel void IOAccelEventMachine2::restart_channel(): no channel associated with stamp_idx 4 (type 4)
dig @173.255.229.191 netip.cc SOA
; <<>> DiG 9.10.3-P4-Debian <<>> @173.255.229.191 netip.cc SOA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 53326
;; flags: qr; QUERY: 0, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; Query time: 102 msec
Verifying that +teancom is my blockchain ID. https://onename.com/teancom
@teancom
teancom / gist:137440924c79f85727d0
Last active August 29, 2015 14:02
make sure file exists before writing to it
if options.has_key? :file then
file = options[:file]
dir = File.dirname(file)
if File.directory?(dir) && File.writable?(dir) then
if File.exists?(file) && ! File.writable?(file) then
abort "Can't write to file. No permission?"
else
$stdout = File.new file, 'w'
end
else
func greet(name: String = "David", day: String = "bleargh") -> String {
return "Hello \(name), today is \(day)."
}
greet("Bob", "Sunday")
func greet2(name: String, day: String) -> String {
return "Hello \(name), today is \(day)."
}
greet2("Bob", "Sunday")
let foo:Bool = true
switch foo {
case true:
println("got here")
case false:
println("won't get here")
case foo == nil:
println("am I exhaustive now?")
default:
### Keybase proof
I hereby claim:
* I am teancom on github.
* I am teancom (https://keybase.io/teancom) on keybase.
* I have a public key whose fingerprint is 8749 3DF5 D272 EA19 2C78 0304 4CA5 FA4F D19E 4536
To claim this, I am signing this object:
# This one works
class DiceSet
def roll(size)
@dice = []
size.times do |x|
@dice[x] = rand(1..6)
end
end