Skip to content

Instantly share code, notes, and snippets.

View murdho's full-sized avatar

Murdho Savila murdho

View GitHub Profile
# Make the code below output "something!"
# by adding a single line of code to line 3.
something = something.something unless something
puts something
# something!
@murdho
murdho / install_ruby_rpi.sh
Last active January 8, 2021 13:12 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 3.0 on the Raspberry Pi (Raspbian)
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 3.0 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/murdho/9560f5a5bd1aa9817b4cedfbaf252e29/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
@murdho
murdho / interrupt.go
Last active October 14, 2021 15:04
Go snippet: wait for interrupt
package interrupt
import (
"os"
"os/signal"
"syscall"
)
func Wait() {
signalChan := make(chan os.Signal, 1)
@murdho
murdho / comment.md
Created February 13, 2019 20:39
Crystal macOS brew ld: library not found for -lssl [libssl-dev]

Crystal not working in Mac OS X Mojave #6875


**jasdeepsingh ** commented on 27 Sep 2018

Solution:

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig Fish Shell: set -U -x PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig

@murdho
murdho / trace.rb
Last active October 24, 2018 12:40
Show trace of method calls and returns (only project files)
@trace_depth = 0
@trace = TracePoint.new(:call, :return) do |tp|
if tp.path.include?("/murdho/Developer/APP_NAME_HERE")
is_a_call = tp.event == :call
is_a_call ? @trace_depth += 1 : @trace_depth -= 1
@trace_depth = 0 if @trace_depth < 0
puts [
" " * @trace_depth,
"\e[33m", # Yellow color start
# Replace "#..." with something to make it return "something!"
# (please use Ruby 2.1 or newer)
something = #...
something.something unless something
# => "something!"

Keybase proof

I hereby claim:

  • I am murdho on github.
  • I am murdho (https://keybase.io/murdho) on keybase.
  • I have a public key whose fingerprint is 00F2 1B91 9FDD 9CA7 F90D 5008 A77F 6771 24C5 8921

To claim this, I am signing this object:

@murdho
murdho / gist:7c42c3421cc1eff73510
Created January 6, 2015 12:39
nokogiri install
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 \
gem install nokogiri -v '1.6.1' -- \
--with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config \
--with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
# After building a new Linode Ubuntu 13.04 image...
ssh root@linode-123
# ...
uname -a
# Linux li348-235 3.12.9-x86_64-linode37 #1 SMP Mon Feb 3 10:01:02 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
apt-get update
apt-get install -y linux-virtual grub-legacy-ec2
require 'function'
# A fibonacci function.
fib = Function.new
fib[0] = 0
fib[1] = 1
fib[Integer] = proc { |i| fib[i - 2] + fib[i - 1] }
p fib[0] # => 0