Skip to content

Instantly share code, notes, and snippets.

uıɐɾ ʞ ʇɐɯɐs samatjain

Block or report user

Report or block samatjain

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
samatjain / wakeonlan.py
Created Feb 22, 2019
wakeonlan wrapper script w/ pre-programmed hostnames and MAC addresses
View wakeonlan.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Send a magic packet to a list pre-programmed hostnames.
wakeonlan.sh 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
samatjain / Encrypted-Amazon-Cloud-Drive.md
Last active May 18, 2017
Setting up a encrypted drive on Amazon Cloud Drive w/ EncFS and acd_cli
View Encrypted-Amazon-Cloud-Drive.md

Environment

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

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

Setup

mkdir -p \
View Meetup-past-events.py
#!/usr/bin/env python3
import collections
import datetime
import pprint
import click
import jinja2
import requests
View Slim-Raspbian.sh
#!/bin/bash
# GUI-related packages
pkgs="
xserver-xorg-video-fbdev
xserver-xorg xinit
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa
gstreamer1.0-libav
epiphany-browser
View keybase.md

Keybase proof

I hereby claim:

  • I am SamatJain on github.
  • I am SamatJain (https://keybase.io/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
samatjain / pyvenvex.py
Last active Jul 12, 2017 — forked from vsajip/pyvenvex.py
Set VIRTUAL_ENV, which appears to be needed on Ubuntu's Python for distribute/pip to install properly
View pyvenvex.py
#
# 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
samatjain / ubicast.tv-download-feed.py
Created Sep 23, 2012
Print the YouTube URLs for a Ubicast.tv videos RSS feed
View ubicast.tv-download-feed.py
#!/usr/bin/env python3
# Take a Ubicast.tv 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 <samat@samat.org>
# License: GPLv3
import re
import sys
import feedparser
@samatjain
samatjain / gist:1499378
Created Dec 19, 2011
Bottle-powered version of OSM XML → JSON proxy
View gist:1499378
#!/usr/bin/env python
import json
import urlparse
import bottle
import requests
from bottle import request, response, route
from bottle import install, uninstall
You can’t perform that action at this time.