Skip to content

Instantly share code, notes, and snippets.

View say4n's full-sized avatar
💻

Sayan Goswami say4n

💻
View GitHub Profile
ʘ‿ʘ
Innocent face
ಠ_ಠ
Reddit disapproval face
(╯°□°)╯︵ ┻━┻
Table Flip / Flipping Table
┬─┬ ノ( ゜-゜ノ)
@say4n
say4n / Wayback Availability JSON API
Created April 18, 2016 07:14
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
http://archive.org/wayback/available?url=example.com
which might return:
{
"archived_snapshots": {
"closest": {
"available": true,
"url": "http://web.archive.org/web/20130919044612/http://example.com/",
@say4n
say4n / Wikipedia API
Created April 19, 2016 13:06
API to get summary of articles passed as query parameter.
https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&titles={QUERY_STRING}
@say4n
say4n / LICENSE
Last active May 9, 2017 06:37
Just a plain simple boring xkcd comic downloader with download progress indicator.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Sayan Goswami <goswami.sayan47@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@say4n
say4n / USAGE.md
Last active October 23, 2016 15:34
Python basic time profiler

To use the profiler, just use import pyprofile and if the function to be profiled is named stupid_code use the profiler as follows

@pyprofile
def stupid_code():
    # do something stupid here
@say4n
say4n / Blank tiles in Mac dock
Last active May 9, 2017 06:38
Add blank space tiles to Mac Dock
Open terminal and type
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
@say4n
say4n / build.sh
Created May 9, 2017 06:34
Build jekyll website, copy to production folder, spin up http server.
# variables
src="./build/"
dst=".."
# jekyll build
echo "Runnning jekyll build"
jekyll build --destination $src
# copy to root
echo "Moving files from $src to $dst"
@say4n
say4n / repeatedtimer.py
Created June 8, 2017 05:39
Reapeat a python function after a set interval, non blocking code !
import threading
import time
class RepeatedTimer(object):
def __init__(self, interval, _function, *args, **kwargs):
self._timer = None
self.interval = interval
self.function = _function
self.args = args
@say4n
say4n / starter.cpp
Last active July 24, 2017 14:26
Competitive coding boilerplate
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
@say4n
say4n / image_pixelate.py
Created October 24, 2017 17:34
Pixelate an image without changing it's resolution!
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
import PIL
import PIL.Image as Image
plt.axis('off')