Skip to content

Instantly share code, notes, and snippets.


uıɐɾ ʞ ʇɐɯɐs samatjain

View GitHub Profile
samatjain / du-cpp17.cpp
Created Mar 12, 2021
du ioring comparison
View du-cpp17.cpp
#include <iostream>
#include <fstream>
#include <filesystem>
#include <chrono>
using namespace std;
using Timer = std::chrono::high_resolution_clock;
using TimePoint = std::chrono::time_point<Timer>;
View lowest_bits_set.cpp
#include <bitset>
#include <cassert>
#include <iostream>
using MaskType = uint64_t;
static int LowestBitSet(const MaskType v)
return __builtin_ffsl(v);
samatjain /
Created Feb 22, 2019
wakeonlan wrapper script w/ pre-programmed hostnames and MAC addresses
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Send a magic packet to a list pre-programmed hostnames. is the old shell-based version; please use this program instead.
Requires the "wakeonlan" program is installed, i.e.
View gist:10d72cf594ae1778feb8422c41cefba3
#include <algorithm>
#include <chrono>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <unordered_set>
#include <thread>
samatjain /
Last active May 18, 2017
Setting up a encrypted drive on Amazon Cloud Drive w/ EncFS and acd_cli


export ACD_LOCAL=$HOME/.cache/Amazon-Cloud-Drive

# To use this file later
export ENCFS6_CONFIG=$ACD_LOCAL/encfs6.xml


mkdir -p \
#!/usr/bin/env python3
import collections
import datetime
import pprint
import click
import jinja2
import requests
# GUI-related packages
xserver-xorg xinit
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa

Keybase proof

I hereby claim:

  • I am SamatJain on github.
  • I am SamatJain ( on keybase.
  • I have a public key whose fingerprint is E95D 7465 5B35 C5F6 B3B6 68CC 20C6 F0A6 4A45 6FBA

To claim this, I am signing this object:

samatjain /
Last active Jul 12, 2017 — forked from vsajip/
Set VIRTUAL_ENV, which appears to be needed on Ubuntu's Python for distribute/pip to install properly
# Copyright (C) 2013 Vinay Sajip. New BSD License.
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
samatjain /
Created Sep 23, 2012
Print the YouTube URLs for a videos RSS feed
#!/usr/bin/env python3
# Take a RSS feed (usually found on channel pages) and print all the YouTube links available for the video. Said list can be fed into youtube-dl so videos can be watched offline
# Author: Samat Jain <>
# License: GPLv3
import re
import sys
import feedparser