Skip to content

Instantly share code, notes, and snippets.

View adityavm's full-sized avatar
👋
Looking for new opportunities

Aditya Mukherjee adityavm

👋
Looking for new opportunities
View GitHub Profile
@adityavm
adityavm / sonoakai_atlantis_custom.vim
Created March 5, 2022 04:00
Customisation to sonokai to make greys a bit darker for better contrast
let palette = {
\ 'black': ['#1c1e1f', '237'],
\ 'bg0': ['#273136', '235'],
\ 'bg1': ['#313b42', '236'],
\ 'bg2': ['#353f46', '236'],
\ 'bg3': ['#3a444b', '237'],
\ 'bg4': ['#414b53', '237'],
\ 'bg_red': ['#ff6d7e', '203'],
\ 'diff_red': ['#55393d', '52'],
\ 'bg_green': ['#a2e57b', '107'],
@adityavm
adityavm / README.md
Last active January 24, 2020 21:43
Git branch descriptions

Install

Put git alias in git config Put fish aliases / functions in fish config folder

Usage

set a description

git checkout branch_name
git about "description for this branch"
@adityavm
adityavm / chainable.js
Last active February 17, 2018 16:43
How to build properties that can be called or chained
/**
* Executors
* ---
* These perform the final action at each step of the chain.
*/
const keys = Object.create(null);
keys.red = function(str) { return `red(${str})`; },
keys.red.type = "red";
@adityavm
adityavm / RemoveFluxArtefact.user.js
Last active April 24, 2017 07:00
Remove artefacts when maximising HTML5 videos while f.lux is active
// ==UserScript==
// @name Remove full screen HTML5 video artefacts under f.lux
// @namespace RemoveFluxVideoArtefacts
// @include *
// @author Aditya Mukherjee
// @description Remove artefacts when maximising HTML5 videos while f.lux is active
// ==/UserScript==
/**
* Solution from this chrome extension[1], for those who don't want to install a full extension.
@adityavm
adityavm / BlankUserscript.user.js
Created April 24, 2017 06:39
Empty Userscript to be the starting point for other scripts
// ==UserScript==
// @name Blank Userscript Template
// @namespace BlankUserscriptTemplate
// @include *
// @author Aditya Mukherjee
// @description Empty Userscript to be the starting point for other scripts
// ==/UserScript==
// code goes here
function Model(msg){
this.message = msg;
}
r.Inheritor(Model, r.Observer);
let mp = Model.prototype;
mp.change = function(msg) {
this.message = msg;
this.emit("valchange");
}
mp.model = function() {
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<pattern id="image" x="0" y="0" patternUnits="userSpaceOnUse" height="1" width="1">
<image x="1" y="1" height="200" width="200" xlink:href="/favicon.png"></image>
</pattern>
</defs>
<circle id='top' cx="180" cy="120" r="80" fill="url(#image)"/>
</svg>
@adityavm
adityavm / wherefrom.js
Created April 25, 2011 13:11
bookmarklet to show the referrer for the current page
javascript:var str='';function avm_getL(h){var a=document.createElement('a');a.href=h;return a.hostname}function gup(){var results=document.referrer.toString().match(/q=([A-Z\%0-9]+)/i);if(!results)return'';else return results[1]}function avm_cb(d){var div=document.createElement('div');div.id='avm_ref_div';if(document.referrer==''){div.innerHTML='You came here independently, i.e. by typing in the URL or from an external application'}else{div.innerHTML='You came here from ';var a=document.createElement('a');a.href=(str==='Google')?'http://google.com/search?q='+gup():document.referrer;if(!d.query.results){a.innerHTML=(str)?str:'Unknown'}else{a.innerHTML=d.query.results.title}a.setAttribute('style','color:#ddd; text-decoration:underline;');div.appendChild(a)}div.innerHTML+='.';div.setAttribute('style','position:fixed; top:0; left:0; opacity:0.8; background-color:#222; color:#eee; font: 9pt \'Helvetica Neue\',Arial,sans-serif; padding:2px 4px;');document.body.appendChild(div)}if(avm_getL(document.referrer)==='www
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Conversation | See how it started!</title>
<script type="text/javascript" charset="utf-8">
var odd = "", count = 0;
function tweet(tweet){
<?
# wanted to use Python for this, but I'll need to install
# simpleJSON and stuff, so it's just quicker with PHP at this point
header("Content-type:text/plain");
$last_count = file_get_contents('lastFetch');
$tweets = json_decode(file_get_contents("http://USERNAME:PASSWORD@twitter.com/statuses/friends_timeline.json?since_id=$last_count&count=50"), true);
if(!isset($tweets[0]))
die('No new tweets');