Skip to content

Instantly share code, notes, and snippets.

View toanant's full-sized avatar

Abhishek | अभिषेक toanant

View GitHub Profile
@toanant
toanant / udl.py
Last active January 3, 2016 11:59
Download Youtube video using Youtube-dl and Youtube API
#!/usr/bin/python
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
import subprocess
# Set DEVELOPER_KEY to the API key value from the APIs & auth > Registered apps
# tab of

Keybase proof

I hereby claim:

  • I am toanant on github.
  • I am toanant (https://keybase.io/toanant) on keybase.
  • I have a public key whose fingerprint is D61C 5C79 B62E 7DD7 21E2 0AB3 F23D CD3B 5525 4758

To claim this, I am signing this object:

@toanant
toanant / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@toanant
toanant / mandelbrot.sql
Last active August 29, 2015 14:25 — forked from rupey/mandelbrot.sql
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@toanant
toanant / snowden-ietf93.md
Last active August 29, 2015 14:27 — forked from mnot/snowden-ietf93.md
Transcript of Edward Snowden's comments at IETF93.
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!DOCTYPE document SYSTEM "rml.dtd">
<document filename="student-feedback.pdf">
<docinit>
<registerTTFont faceName="Arial" fileName="/home/toanant/Xamcheck/codebase/xamcheck-feedback/xamcheck_feedback/static/fonts/Arial.ttf"/>
<registerTTFont faceName="ArialItalic" fileName="/home/toanant/Xamcheck/codebase/xamcheck-feedback/xamcheck_feedback/static/fonts/ArialItalic.ttf"/>
<registerTTFont faceName="ArialBold" fileName="/home/toanant/Xamcheck/codebase/xamcheck-feedback/xamcheck_feedback/static/fonts/ArialBold.ttf"/>
<registerTTFont faceName="ArialBoldItalic" fileName="/home/toanant/Xamcheck/codebase/xamcheck-feedback/xamcheck_feedback/static/fonts/ArialBoldItalic.ttf"/>
</docinit>
<template showBoundary="0" pagesize="(420mm, 297mm)">
# Enter your code here. Read input from STDIN. Print output to STDOUT
import copy
all_valid_routes = {
'A': ['AB', ],
'B': ['BC', 'BC', 'BC', 'BD', 'BD', 'BA'],
'C': ['CD', 'CD', 'CD', 'CB', 'CB', 'CB'],
'D': ['DE', 'DC', 'DC', 'DC', 'DB', 'DB'],
'E': ['ED'],
}
from itertools import combinations
def is_palindrome(string):
if string == string[::-1]:
return True
return False
def get_palindrome_length(string):

$cd ~/; openssl dhparam -out dhparams.pem 2048; sudo mv dhparams.pem /etc/ssl/

cd /opt; sudo wget https://dl.eff.org/certbot-auto; sudo chmod a+x certbot-auto

sudo mkdir -p /var/www/<domain name>/ # e.g. /var/www/toanant.in/

sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=8388608
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo mkswap /swapfile1
sudo swapon /swapfile1
free -m
sudo swapon -s
sudo -s
echo '/swapfile1 none swap sw 0 0' >> /etc/fstab
echo 'vm.swappiness=30' >> /etc/sysctl.conf