Skip to content

Instantly share code, notes, and snippets.

View miketheman's full-sized avatar
🌴
On vacation

Mike Fiedler miketheman

🌴
On vacation
View GitHub Profile
@miketheman
miketheman / example.rb
Created January 27, 2012 18:52
ruby - moved grep from string method to enumerable
ruby-1.8.7-p352 $ irb
1.8.7 :001 > thing = 'sometext'
=> "sometext"
1.8.7 :002 > thing.grep(/some/)
=> ["sometext"]
ruby-1.9.2-p290 $ irb
1.9.2p290 :001 > thing = 'sometext'
=> "sometext"
1.9.2p290 :002 > thing.grep(/some/)
@miketheman
miketheman / console
Created September 21, 2017 18:13
core/gmp multiple versions
★ Install of core/readline/6.3.8/20170513213506 complete with 0 new packages installed.
guile: Resolved dependency 'core/readline' to /hab/pkgs/core/readline/6.3.8/20170513213506
guile: WARN
guile: WARN The following runtime dependencies have more than one version
guile: WARN release in the full dependency chain:
guile: WARN
guile: WARN * core/gmp ( core/gmp/6.1.2/20170526062114 core/gmp/6.1.0/20170513202112 )
guile: WARN
guile: WARN The current situation usually arises when a Plan has a direct
guile: WARN dependency on one version of a package (`acme/A/7.0/20160101200001`)
@miketheman
miketheman / agent_version.sh-session
Last active May 22, 2017 13:57
Retrieve metadata about systems from Datadog
# Ensure you have `jq` installed - http://stedolan.github.io/jq/
$ brew install jq
...
/usr/local/Cellar/jq/1.4: 15 files, 748K, built in 9 seconds
# Grab your API_KEY and create an APPLICATION_KEY from https://app.datadoghq.com/account/settings#api
$ export API_KEY=aaabbbccc
$ export APPLICATION_KEY=111222333
$ curl -s "https://app.datadoghq.com/reports/v1/overview?with_meta=true&api_key=$API_KEY&application_key=$APPLICATION_KEY" \
@miketheman
miketheman / console.sh-session
Created December 25, 2016 10:03
Crystal Lang 0.20.3 Socket::IPAddress change
$ crystal --version
Crystal 0.20.1 (2016-12-05)
$ crystal run test.cr
1482659875.246: 127.0.0.1:55157 "This is only a test."
$ crystal --version
Crystal 0.20.3 (2016-12-23)
$ crystal run test.cr
Error in test.cr:10: wrong number of arguments for 'Socket::IPAddress.new' (given 3, expected 2)
Overloads are:
@miketheman
miketheman / chefdiff.sh
Last active May 24, 2016 22:52
Bash function to diff most recent Chef backup. Place in `/etc/profile.d/chefdiff.sh`
# Usage: `chefdiff <filename>`
chefdiff() {
p=`readlink -f $1`
f=`ls /var/chef/backup$p* | sort | tail -n 1`
diff -u $f $1
}

Keybase proof

I hereby claim:

  • I am miketheman on github.
  • I am miketheman (https://keybase.io/miketheman) on keybase.
  • I have a public key ASAvv9Z5J9DxlPsLOBx0QCKOAY42qSJvMNxWzR6t2tRLLQo

To claim this, I am signing this object:

$ crystal build --release try_to_fail.cr
$ for i in `seq 10` ; do ./try_to_fail ; done
"first before"
Error writing datagram: Connection refused (Errno)
[4318973645] *Errno::new<String>:Errno +541
[4319016353] *UDPSocket#send<UDPSocket, String, Socket::IPAddress>:Int64 +593
[4319008402] main +10322
"first before"
Error writing datagram: Connection refused (Errno)
[4415098573] *Errno::new<String>:Errno +541
@miketheman
miketheman / gist:bee9a466051a02543a14
Created February 18, 2016 03:55
statsd.cr trace
Error writing file: Connection refused (Errno)
[4422141682] *CallStack::unwind:Array(Pointer(Void)) +82
[4422141585] *CallStack#initialize<CallStack>:Array(Pointer(Void)) +17
[4422141544] *CallStack::new:CallStack +40
[4422213281] *Exception@Exception#initialize<Errno, String>:CallStack +33
[4422213203] *Errno#initialize<Errno, String>:CallStack +115
[4422213060] *Errno::new<String>:Errno +100
[4422250063] *UDPSocket@IO::FileDescriptor#unbuffered_write<UDPSocket, Slice(UInt8)>:Int32 +399
[4422253517] *UDPSocket@IO::Buffered#write<UDPSocket, Slice(UInt8)>:(Nil | Int32) +109
[4422253371] *UDPSocket@IO#write_utf8<UDPSocket, Slice(UInt8)>:Nil +59
@miketheman
miketheman / 1_command.log
Last active February 6, 2016 22:48
otto dev failure for vmware_fusion project
$ otto dev
==> Verifying created layer: consul
==> Verifying created layer: python2.7
==> Creating local development environment with Vagrant if it doesn't exist...
Bringing machine 'default' up with 'virtualbox' provider...
The clone environment hasn't been created yet. To clone from
another Vagrantfile, it must already be created with `vagrant up`.
It doesn't need to be running.
Additionally, the created environment must be started with a provider
@miketheman
miketheman / init_nginx.conf
Created January 21, 2016 22:10
default nginx configs
description "nginx - small, powerful, scalable web/proxy server"
start on filesystem and static-network-up
stop on runlevel [016]
expect fork
respawn
pre-start script
[ -x /usr/sbin/nginx ] || { stop; exit 0; }