Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Vikrum vikrum

🎯
Focusing
Block or report user

Report or block vikrum

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
@vikrum
vikrum / .osx
Last active Oct 29, 2019
Vikrum's Most Excellent Antiques, Curiosities, and Dotfiles
View .osx
defaults write com.apple.Safari IncludeDebugMenu 1
defaults write com.apple.dock no-bouncing -bool TRUE
defaults write com.apple.notificationcenterui bannerTime 1
defaults write -g ApplePressAndHoldEnabled -bool false
@vikrum
vikrum / AndroidManifest.xml
Last active Jul 21, 2019
Firebase+Android sample app with background Service + local notifications.
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bgfirebaseapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
@vikrum
vikrum / firedns.js
Created Jan 14, 2013
A custom DNS server in NodeJS that saves off queries to Firebase so they can be retrieved later. Accompanying blog post: http://5f5.org/ruminations/dns-debugging-over-http.html
View firedns.js
var crypto = require('crypto');
var dns = require('native-dns');
var rest = require('restler');
var server = dns.createServer();
server.on('request', function (request, response) {
var domain = request.question[0].name;
if(domain == 'webutils.flourishworks.com') {
// Don't log this because it can't be uniquely identified and subsequently retrieved
View delete_all_tweets.py
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=".css">
<script src=".js"></script>
</head>
<body>
@vikrum
vikrum / oneliners.txt
Last active Mar 3, 2017
Various One Liners
View oneliners.txt
# On bash + Linux
# Show TCP sockstats every 5 seconds
$ while [ : ]; do echo -n `date`; echo -n ": "; cat /proc/net/sockstat | sed 'N;s/\n/ /;' | grep TCP; sleep 5; done
# Show netstat connection state counts every 5 seconds
$ while [ : ]; do echo -n `date`; echo -n ": "; netstat -n | awk '/^tcp/ {t[$NF]++}END{for(state in t){print state, t[state]} }' | tr '\n' ' '; echo ; sleep 5; done
# Show top 25 established IPs and their counts
$ lsof -n|grep TCP|grep ESTABLISHED|awk '{print $9}' |grep -e "->"|awk -F '->' '{print $2}'|awk -F ':' '{print $1}'|sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n|uniq -c|sort -rn|head -25
@vikrum
vikrum / 401k
Last active Jan 18, 2017
Quantopian 401K simplified SPY model; front loaded (4 pay cycles) VS throughout year (26 pay cycles) of $27k
View 401k
def initialize(context):
# Reference to SPY
context.spy = sid(8554)
schedule_function(buySpread, date_rules.week_start(), time_rules.market_open())
def buyFront(context, data):
weekno = get_datetime('US/Eastern').isocalendar()[1]
# Invest in first 4 pay cycles
if (weekno % 2 == 0) and (weekno <=8):
if data.can_trade(context.spy):
@vikrum
vikrum / App.scala
Created Jun 26, 2012
Scala REPL exposed via Netty
View App.scala
object App extends Logging {
def main(args: Array[String]) = {
setupNetty
scalaReplConsole
}
/**
* Setup Netty for things like logging, etc. This should happen first. Do not get rid of this.
* You'll have a calamity on your hands if it needs to log under stress and it is unable to.
View openscad
// http://budweiser.cadstudio.cz/2015/08/shadow-cube-3d-model-of-c-d.html
$fn=100;
S=10; // size in mm
// "C" "A" "D" - modelled letters
intersection() {
M("A", S); // "A"
You can’t perform that action at this time.