Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Morgan seven1m

View GitHub Profile
@seven1m
seven1m / lots_of_symbols.rb
Last active Dec 21, 2021
Adaptation of the first 10,000 words from https://gist.github.com/h3xx/1976236, as a list of Ruby symbols
View lots_of_symbols.rb
:the
:of
:and
:to
:a
:in
:that
:I
:was
:he
@seven1m
seven1m / awsping.sh
Last active Nov 8, 2021
Script to get latency for 3 AWS US regions
View awsping.sh
#!/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
@seven1m
seven1m / hello_world_llvm.cpp
Last active Apr 23, 2022
Simple 'hello world' example in LLVM IRBuilder
View hello_world_llvm.cpp
// % 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;
@seven1m
seven1m / frame.py
Last active Sep 4, 2021
A small Python script that creates a semi-transparent resizable frame that stays on top. I use it to mark an area of my screen (the area where my webcam is overlayed) off-limits when screencasting.
View frame.py
#!/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
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
@seven1m
seven1m / download_albums_from_flickr.rb
Created Sep 3, 2020
Ruby script to download albums from Flickr
View download_albums_from_flickr.rb
# 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'
@seven1m
seven1m / fzf_branch_selection.zsh
Created Aug 6, 2020
Alias I use for switching branches
View fzf_branch_selection.zsh
# 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}' |
View .fetchmailrc
poll mail.morgn.net protocol POP3
user "tim" with password "blablablabla" is tim here
@seven1m
seven1m / fix.sh
Created May 28, 2019
fix mysql2 gem install on macos
View fix.sh
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"
@seven1m
seven1m / openbsd.md
Last active Apr 29, 2019
things I learned using OpenBSD on a laptop for the first time
View openbsd.md

OpenBSD

How to disable console window on X11 start up

Comment out the xconsole line in /etc/X11/xenodm/Xsetup_0.

How to install intel wireless drivers

As root: