Skip to content

Instantly share code, notes, and snippets.

View Checksum's full-sized avatar
:octocat:
Doing stuff

Srinath Sankar Checksum

:octocat:
Doing stuff
View GitHub Profile
@Checksum
Checksum / markdown.py
Last active August 29, 2015 14:07
Custom Markdown extension in Python
import re
import markdown2
class CustomMarkdown(markdown2.Markdown):
"""
Custom markdown processor that we use for task list
"""
reTaskList = re.compile('''
(?P<prefix>[\r\n|\n|\r]*)
@Checksum
Checksum / fb_linkify.js
Created June 2, 2012 15:43
Bookmarklet to remove Facebook app signin links
(function() {
var links = document.querySelectorAll('.ogAggregationSubstorySlideHeadline > a');
for( var i=0, len=links.length; i < len; i += 1) {
var url = links[i].getAttribute('href');
url = decodeURIComponent(url.split("?")[1].split("&")[2].split("=")[1]);
links[i].setAttribute('href',url);
links[i].setAttribute('target','_blank');
}
}());
@Checksum
Checksum / PHP_SESSION.php
Created June 9, 2012 08:17
Stronger PHP Session IDs
<?php
// Generating stronger PHP session IDs
// Change from default PHPSESSID
ini_set('session.name','my_cookie');
// Use only cookies to prevent session ID hijacking
ini_set('session.use_cookies', 'true');
ini_set('session.use_only_cookies', 'true');
@Checksum
Checksum / gist:3291825
Created August 8, 2012 03:35
Macbook Retina Hardware Details
// A few terminal commands to determine SSD, display manufacturer
// Display Manufacturer
ioreg -lw0 | grep \"EDID\" | sed "/[^<]*</s///" | xxd -p -r | strings -6
LPXXXX = LG
LSNXXXX = Samsung
// SSD Manufacturer
@Checksum
Checksum / README.md
Last active December 10, 2015 20:48 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Keybase proof

I hereby claim:

  • I am Checksum on github.
  • I am checksum (https://keybase.io/checksum) on keybase.
  • I have a public key whose fingerprint is EEA1 CD10 320D 497A B440 F6BD 45DD 4E24 58A5 101A

To claim this, I am signing this object:

@Checksum
Checksum / JSON_response.js
Created July 27, 2012 06:36
Node.js get JSON response
require('http').request({
host: 'example.com',
path: '/path/to/get',
method: 'GET'
}, function(res) {
res.setEncoding('utf8');
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
@Checksum
Checksum / building-elm.md
Last active February 27, 2019 05:35
Building Elm 0.19
  • Clone elm/compiler
  • Install stack
  • Install required version of cabal using stack --resolver lts-9 install cabal-install (commercialhaskell/stack#3453 (comment))
  • PATH=~/.local/bin:$PATH stack init --solver to install the required version of GHC
  • PATH=~/.local/bin:$PATH stack build --flag elm:dev to build
@Checksum
Checksum / regex.md
Created March 11, 2019 23:47
Regex Tricks
  • Split every character: "something".split(/(?!^)/)

  • Never split: "something".split(/^.$/)

@Checksum
Checksum / sqlcmd.sql
Created April 9, 2019 00:53
sqlcmd cheat sheet
-- type 'go' to execute the block
-- List all tables
1> select * from information_schema.tables;
-- Describe table
1> exec sp_columns table_name;