Skip to content

Instantly share code, notes, and snippets.

View minhajuddin's full-sized avatar
⌨️
Beep boop, beep boop

Khaja Minhajuddin minhajuddin

⌨️
Beep boop, beep boop
View GitHub Profile
@minhajuddin
minhajuddin / ticker.ex
Created October 26, 2016 21:05
A ticker for elixir, which emits a tick event for every interval
defmodule Ticker do
require Logger
# public api
def start(recipient_pid, tick_interval, duration \\ :infinity) do
# Process.monitor(pid) # what to do if the process is dead before this?
# start a process whose only responsibility is to wait for the interval
ticker_pid = spawn(__MODULE__, :loop, [recipient_pid, tick_interval, 0])
# and send a tick to the recipient pid and loop back
send(ticker_pid, :send_tick)
schedule_terminate(ticker_pid, duration)
@minhajuddin
minhajuddin / alacritty.yml
Created September 11, 2023 02:53
alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
TERM: xterm-256color
# # TERM variable
# #
# # This value is used to set the `$TERM` environment variable for
@minhajuddin
minhajuddin / remove_video_controls_on_netflix.js
Created December 8, 2022 20:35
grease monkey script to remove the video controls from netflix
// ==UserScript==
// @name remove the video controls from netflix
// @version 1
// @grant GM_addStyle
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
@minhajuddin
minhajuddin / README.md
Created December 21, 2011 03:29
Script to retrieve content from google cache
@minhajuddin
minhajuddin / .curlrc
Created May 20, 2021 12:13
Curl Performance Metrics
--silent
--write-out "@/home/minhajuddin/r/dot3/curl-meta-fmt"
@minhajuddin
minhajuddin / ping_pong.exs
Created March 31, 2021 11:47
A game of ping pong between two Elixir processes
defmodule Player do
def start(p1, p2) do
# start their game p1 sends a ping to p2
send(p2, {:ping, p1})
end
def play do
receive do
{input_message, _from = opponent_pid} ->
respond(opponent_pid, input_message)
@minhajuddin
minhajuddin / README.md
Last active October 28, 2020 19:53
HTTP Connection pooling benchmark

Performance comparison

For a 100 requests.

$ ruby ~/s/bench_connection_pool.rb
       user     system      total        real
without  1.329350   0.059367   1.388717 (  7.018174)
with     0.222370   0.000000   0.222370 (  1.659621)
@minhajuddin
minhajuddin / basic-setup.sh
Created September 16, 2011 16:45
rails ubuntu setup script
#!/bin/bash
#script to install all the required software
#update the system
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get upgrade -y
#install required software
sudo apt-get install vim-gnome curl git-core bison build-essential zlib1g-dev libssl-dev libreadline6-dev libxml2-dev autoconf libxslt1-dev ctags gitk git-gui -y
defmodule SearchWorker do
use GenServer
@idle_timeout_ms 10 * 60 * 1000
# client api
def touch(pid) do
GenServer.cast(pid, :touch)
end
@minhajuddin
minhajuddin / focus.start.bash
Created March 22, 2012 05:45
My xmonad config
#!/bin/bash
# load resources
xrdb -merge .Xresources
#xsetroot -solid '#222'&
# map caps lock as extra escape
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'&
# start clipboard manager
parcellite&