Skip to content

Instantly share code, notes, and snippets.

View vihanb's full-sized avatar
🐶
Probably at the doggo shelter

Vihan vihanb

🐶
Probably at the doggo shelter
View GitHub Profile
@lrvick
lrvick / bitcolor.js
Created March 18, 2012 20:02
Javascript functions for doing fast binary/hex/RGB color conversions using bitwise operations.
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){
@slevithan
slevithan / xregexp-lookbehind2.js
Created April 14, 2012 21:06
Simulating lookbehind in JavaScript (take 2)
// Simulating infinite-length leading lookbehind in JavaScript. Uses XRegExp.
// Captures within lookbehind are not included in match results. Lazy
// repetition in lookbehind may lead to unexpected results.
(function (XRegExp) {
function prepareLb(lb) {
// Allow mode modifier before lookbehind
var parts = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*)\)$/.exec(lb);
return {
@andrep
andrep / configure.ios
Created December 3, 2013 23:51
A script to run `./configure` for various iOS devices. Lightly tested and WorksForMe™.
#!/bin/sh -x -e
case "$ARCH" in
armv6-apple-darwin10|armv7-apple-darwin10|armv7s-apple-darwin10|arm64-apple-darwin10|i386-apple-darwin11)
;;
*)
cat <<EOF
Must set ARCH environment variable to
armv6-apple-darwin10 = All iOS devices
@DataKinds
DataKinds / puddle.svg
Last active February 18, 2016 04:10
cool svg animation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ConorOBrien-Foxx
ConorOBrien-Foxx / WeArePPCG.js
Last active February 6, 2022 06:57
A userscript to redesign the PPCG website
// ==UserScript==
// @name favicon
// @namespace Cᴏɴᴏʀ O'Bʀɪᴇɴ
// @version 1
// @grant none
// ==/UserScript==
function qS(x){
return document.querySelector(x);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Build tensorflow on OSX with NVIDIA CUDA support (GPU acceleration)

These instructions are based on Mistobaan's gist but expanded and updated to work with the latest tensorflow OSX CUDA PR.

Requirements

OS X 10.10 (Yosemite) or newer

@turbo
turbo / unitext.md
Last active April 6, 2016 23:43
Format text with unicode only.

unitext

Format text with nothing but Unicode symbols. (Partially supported in Chrome)

Style A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Uppercase, Sans, Regular A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Lowercase, Sans, Regular a b c d e f g h i j k l m n o p q r s t u v w x y z
Uppercase, Serif, Regular 𝐀 𝐁 𝐂 𝐃 𝐄 𝐅 𝐆 𝐇 𝐈 𝐉 𝐊 𝐋 𝐌 𝐍 𝐎 𝐏 𝐐 𝐑 𝐒 𝐓 𝐔 𝐕 𝐖 𝐗 𝐘 𝐙
Lowercase, Serif, Regular 𝐚 𝐛 𝐜 𝐝 𝐞 𝐟 𝐠 𝐡 𝐢 𝐣 𝐤 𝐥 𝐦 𝐧 𝐨 𝐩 𝐪 𝐫 𝐬 𝐭 𝐮 𝐯 𝐰 𝐱 𝐲 𝐳
@ConorOBrien-Foxx
ConorOBrien-Foxx / caret_pathfinder.user.js
Last active March 16, 2016 01:45
Caret Patthfinder
// ==UserScript==
// @name Caret Pathfinder
// @namespace ^
// @version 1
// @description ^^^
// @author Conor O'Brien
// @match *://chat.stackexchange.com/*
// @grant none
// ==/UserScript==
@turbo
turbo / ohnoes.md
Last active September 30, 2016 18:19
Serverless YouTube stream decoder.

Tired of pseudo-client-side YouTube downloaders? Then it's time to get right to the source. Just create a new bookmark, type

javascript:

in the "link" field and then paste this code after it:

a=function(g,h,i){return i.indexOf(g)==h};b=yt.player.Application.create('player-api',ytplayer.config);b.dispose();d=JSON.stringify(b.getVideoData()),e=d.match(/https:[^"]+videoplayback[^"]+/g),f=e.filter(z=&gt;z.length&lt;1000);for(c of (f.length?(f.filter(a).map((j,k)=&gt;j+'&amp;signature='+d.match(/[0123456789ABCDEF.]+(?=")/g).filter(z=&gt;z.length&gt;20).filter(a)[k])):e.filter(a)))if(~["141","251","140","171","250","249"].indexOf(new URLSearchParams(c.split('?')[1]).get('itag')))window.location=c