Skip to content

Instantly share code, notes, and snippets.

@tfrench
tfrench / leader_election.py
Last active April 13, 2023 07:28
etcd v3 leader election using Python
"""etcd3 Leader election."""
import sys
import time
from threading import Event
import etcd3
LEADER_KEY = '/leader'
LEASE_TTL = 5
SLEEP = 1
@sonots
sonots / cudaStreamCallback.md
Last active November 2, 2018 14:12
Concurrency is lost by cudaStreamCallback?
$ nvcc simpleCallback.cu -O2 -o simpleCallback
$ nvprof -f -o simpleCallback.nvvp ./simpleCallback | grep elapsed
No callback: elapsed time = 1.534s
One callback: elapsed time = 1.498s
Two callback: elapsed time = 3.718s
Four callback: elapsed time = 5.194s

As increasing callbacks, it becomes slow...

@shagunsodhani
shagunsodhani / DistributedGraphLab.md
Created April 11, 2016 02:01
Notes for "Distributed GraphLab: A Framework for Machine Learning and Data Mining in the Cloud" paper.

Introduction

  • GraphLab abstraction exposes asynchronous, dynamic, graph-parallel computation model in the shared-memory setting.
  • This paper extends the abstraction to the distributed setting.
  • Link to the paper.

Characteristics of MLDM (Machine Learning and Data Mining)

  • Graph Structured Computation
  • Sometimes computation requires modeling dependencies between data.
@tevino
tevino / epoll.go
Last active January 20, 2024 22:50
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@rbanick
rbanick / manually_rollback_homebrew.md
Last active August 25, 2020 23:21
How to manually roll back homebrew formula on a UNIX platform

Rolling back Homebrew formula on a UNIX platform

The problem

Sometimes brew updates break your computer or a piece of software. This is usually really unpleasant as it can take some time to diagnose which formula at which version did so. Even if you can diagnose, it's not very clear how to roll back homebrew softwares to previous versions.

How to fix it

@quickshiftin
quickshiftin / osx-brew-gnu-coreutils-man.sh
Created February 21, 2014 07:25
Running GNU coreutils via Homebrew on your Mac? Here's a one-liner to get the manpages working!
# Short of learning how to actually configure OSX, here's a hacky way to use
# GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise
alias man='_() { echo $1; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1; else man $1; fi }; _'
@wizardishungry
wizardishungry / commands.sh
Created October 23, 2013 02:06
list of new commands in OSX Mavericks
/usr/bin/a2p5.16
/usr/bin/afida
/usr/bin/btmmdiagnose
/usr/bin/c2ph5.16
/usr/bin/config_data5.16
/usr/bin/corelist5.16
/usr/bin/cpan2dist5.16
/usr/bin/cpan5.16
/usr/bin/cpanp-run-perl5.16
/usr/bin/cpanp5.16
@jellybeansoup
jellybeansoup / cltools.sh
Last active March 7, 2024 22:57
Install Autoconf and Automake on OS X Mountain Lion
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@solar
solar / zsh-5.0.0.sh
Created October 12, 2012 05:00
Install zsh 5.0.0 on CentOS/RH 6.3
# install zsh-5.0.0
# prerequisite: gcc ncurses-devel readline-devel pcre-devel zlib-devel
curl -L http://jaist.dl.sourceforge.net/project/zsh/zsh/5.0.0/zsh-5.0.0.tar.bz2 | tar jx
cd zsh-5.0.0/
./configure --prefix=/usr/local/zsh/5.0.0 --enable-cap --enable-pcre --enable-multibyte
make
sudo make install
sudo alternatives --install /usr/local/bin/zsh zsh /usr/local/zsh/5.0.0/bin/zsh 50000
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 21, 2024 20:54
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname