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
@pesterhazy
pesterhazy / building-sync-systems.md
Last active June 2, 2024 23:12
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

Some Title

Some Description Some text

Click Me To Expand

#!/bin/zsh
@nadavrot
nadavrot / Matrix.md
Last active May 22, 2024 13:38
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

@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
@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
@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)
@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 ""
@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

@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"
@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"
})