Skip to content

Instantly share code, notes, and snippets.

Umar Hansa umaar

Block or report user

Report or block umaar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@umaar
umaar / setup.sh
Created Jan 28, 2019 — forked from bradp/setup.sh
New Mac Setup Script
View setup.sh
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@umaar
umaar / README.md
Created Jan 25, 2019 — forked from novemberborn/README.md
AVA throwsAsync transform for jscodeshift
View README.md

Usage:

$ npx jscodeshift -t https://gist.githubusercontent.com/novemberborn/c2cdc94020083a1cafe3f41e8276f983/raw/eaa64c55dfcda8006fc760054055372bb3109d1c/transform.js test.js

See https://github.com/facebook/jscodeshift#usage-cli for further details.

@umaar
umaar / perceptron.js
Created Sep 15, 2018 — forked from primaryobjects/perceptron.js
Perceptron in JavaScript, a simple example. Neural network. See https://jsfiddle.net/qu960cc2/1/
View perceptron.js
function Perceptron(opts) {
if (!opts) opts = {}
var debug = 'debug' in opts ? opts.debug : false;
var weights = 'weights' in opts
? opts.weights.slice()
: []
var threshold = 'threshold' in opts
View google-location-history-to-gpx.md

convert google takeout archive for location history from kml to gpx and split file into one per day

gpsbabel -i kml -f Location\ History.kml -o gpx -F out.gpx
gpsbabel -t -i gpx -f out.gpx -x track,merge,pack,split,title="ACTIVE LOG # %Y%m%d" -o gpx -F split.gpx
python2 gpxsplitter.py split.gpx
View subreddit-face-average.js
import * as fs from "fs";
import * as path from "path";
import * as url from "url";
import { exec } from "child_process";
import cuid from "cuid";
import snoowrap from "snoowrap";
import throat from "throat";
import mmm from "mmmagic";
import axios from "axios";
View devtools-protocol-websocket-example.js
const devtools = new WebSocket('ws://localhost:9222/devtools/page/69990451-aaab-4ef8-87b1-ea77b8101b2a');
devtools.onmessage = ({data}) => {
const {result: {result: {value}}} = JSON.parse(data);
console.log('WebSocket Message Received: ', value)
};
devtools.send(JSON.stringify({
id: 1,
method: 'Runtime.evaluate',
View server-timing-example.js
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
lb=18; "Load Balancer",
server-3=104; "Server #3 Startup",
db-read=187; "Database Read",
aws-download=317; "AWS Content Download",
db-write=218; "Database Write",
@umaar
umaar / highlight_tweets.js
Created Jul 12, 2017 — forked from simevidas/highlight_tweets.js
A JS snippet for highlighting tweets with lots of RTs or hearts
View highlight_tweets.js
(function(){
'use strict';
let cap = 100; // 100+ RTs or hearts produces max yellow bg color
$('.tweet', '.stream-items').each((i, tweet) => {
let all_nums = $(tweet)
.find('.ProfileTweet-actionList .ProfileTweet-actionCount:visible')
.map((j, elem) => Number(elem.textContent)).toArray();
@umaar
umaar / taxi.sh
Created Jul 7, 2017 — forked from ericfischer/taxi.sh
NYC taxi with datamaps
View taxi.sh
#!/bin/sh
for i in trip_data_*.csv.zip
do
unzip -c $i
done |
tr -d '\015' |
awk -F, '{print $12 "," $11 " 1:0"; print $14 "," $13 " 1:1"}' |
/data2/data/github/datamaps/encode -z19 -m1 -o nyc-taxi-all
View lol.js
// paste in your console
speechSynthesis.onvoiceschanged = function() {
var msg = new SpeechSynthesisUtterance();
msg.voice = this.getVoices().filter(v => v.name == 'Cellos')[0];
msg.text = Object.keys(window).join(' ');
this.speak(msg);
};
You can’t perform that action at this time.