package manager | sync db | install | upgrade | uninstall |
---|---|---|---|---|
apt-get | update | install | install | remove |
brew | update | install | upgrade | uninstall |
bundle | N/A | install | update | remove |
gem | N/A | install | install | uninstall |
pacman | -y | -S | -S | -R |
View remote_id.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: ruby remote_id.rb pco_id [remote_id] | |
# | |
# pco_id Planning Center profile ID | |
# remote_id Specify new remote ID | |
# | |
# get remote id: | |
# ruby remote_id.rb 1234 | |
# | |
# set remote id: | |
# ruby remote_id.rb 1234 5678 |
View webserver.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = TCPServer.new 3000 | |
loop do | |
client = server.accept | |
method, request_target, _http_version = client.gets.strip.split | |
headers = {} | |
until (line = client.gets) =~ /^\r?\n$/ | |
name, value = line.strip.split(': ') |
View 07_dijkstra.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dijjkstra's Algorithm | |
# Book: Grokking Algorithms by Aditya Y. Bhargava | |
# Chapter: 7 | |
class ShortestPath | |
def initialize(start_node, dest_node, graph) | |
@start_node = start_node | |
@dest_node = dest_node | |
@graph = graph |
View lots_of_symbols.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:the | |
:of | |
:and | |
:to | |
:a | |
:in | |
:that | |
:I | |
:was | |
:he |
View awsping.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ./awsping.sh | sort -n 2.7 | |
# 39.93 us-east-2 | |
# 44.95 us-east-1 | |
# 64.89 us-west-2 | |
function region_latency() { | |
local region="$1" | |
ping -c 1 ec2.$region.amazonaws.com &>/dev/null # throw away the first ping because DNS |
View hello_world_llvm.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// % clang++ $(llvm-config --cxxflags --ldflags --system-libs --libs core) -o hello_world_llvm hello_world_llvm.cpp | |
// % ./hello_world_llvm | |
// hello world | |
#include <llvm/ExecutionEngine/ExecutionEngine.h> | |
#include <llvm/ExecutionEngine/GenericValue.h> | |
#include <llvm/IR/IRBuilder.h> | |
#include <stdio.h> | |
using namespace llvm; |
View frame.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# shamelessly stolen and adapted from https://gist.github.com/KurtJacobson/374c8cb83aee4851d39981b9c7e2c22c | |
# usage: python3 frame.py [width] [height] [x] [y] [opacity] | |
import cairo | |
import gi | |
import sys | |
import resource |
View package_manager_cheat_sheet.md
View download_albums_from_flickr.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# downloads photos from your Flickr albums; each album is its own folder | |
# | |
# usage: | |
# | |
# gem install flickr | |
# FLICKR_API_KEY=abc123def456 FLICKR_SHARED_SECRET=abc123 FLICKR_USER_ID=11111111@N00 ruby download.rb | |
require 'flickr' | |
require 'fileutils' | |
require 'open-uri' |
View fzf_branch_selection.zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fuzzy finder branch selection | |
# if run by itself, switches to the selected branch | |
# if run in a subshell, echos the selected branch | |
function fgb() { | |
if [[ "$ZSH_SUBSHELL" == "0" ]]; then | |
git checkout $(fgb) | |
else | |
gbranches | | |
fzf --height 40% --ansi | | |
awk '{print $1}' | |
NewerOlder