Skip to content

Instantly share code, notes, and snippets.

View jeffrafter's full-sized avatar
You are amazing

Jeff Rafter (he/him) jeffrafter

You are amazing
View GitHub Profile
@jeffrafter
jeffrafter / Magic Potion | How to setup an Asus WL-520gu with OpenWRT for Sound
Last active April 9, 2023 04:45
Magic Potion | How to setup an Asus WL-520gu with OpenWRT for Sound
Note these instructions are all based on the mightyOhm articles. This is a little bit different because I wanted to get alsa sound working (instead of dsp) so that I could overlay effects
and background sound simultaneously.
What to do
==========
install mightyohm trx by blind flashing
setup network and wireless and dhcp
setup the banner for fun
Blind flashing
CURRENT_RUBY = 'ree-1.8.7-2010.02'
RUBY_PATH = "/home/rails/.rvm/rubies/#{CURRENT_RUBY}"
GEM_HOME = "/home/rails/.rvm/gems/#{CURRENT_RUBY}"
ssh_options[:paranoid] = false
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :stages, %w(staging production)
@mikeymckay
mikeymckay / friendly sqlite nosql sinatra
Created August 4, 2010 06:35
friendly sqlite nosql sinatra
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'friendly'
Friendly.configure({
:adapter => "sqlite",
:database => "database.sqlite3"
})
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@joshuaswilcox
joshuaswilcox / current_song
Last active September 2, 2023 14:12
Applescript to show current playing song and determine if its spottily or iTunes that is playing
if application "Spotify" is running and application "iTunes" is not running then
tell application "Spotify"
if player state is stopped then
set display to "No Track Playing"
else
set track_artist to artist of current track
set track_name to name of current track
set track_duration to duration of current track
set seconds_played to player position
set state to ""
@jeffrafter
jeffrafter / sidekiq_inspect.rb
Created August 14, 2014 00:16
Want to inspect your Sidekiq queues?
def fetch_contents(queue = "default", max = 100000)
Sidekiq.redis do |r|
r.lrange("queue:#{queue}", 0, max)
end;
end
def sidekiq_job_breakdown(queue = "default", contents = nil)
re = /\"class":"([0-9A-Za-z_::]+)"/
contents ||= fetch_contents(queue)
@rbishop
rbishop / README.md
Last active April 26, 2022 15:38
A super simple Elixir server for sending Server Sent Events to the browser.

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end
@surma
surma / README.md
Last active March 8, 2024 12:06
webpack-emscripten-wasm

Minimal example making webpack and wasm/Emscripten work together.

Build instructions:

  • Clone this gist
  • npm install
  • npm start
  • Open http://localhost:8080
  • Look at console
@nadavrot
nadavrot / Matrix.md
Last active July 21, 2024 17:27
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of