Skip to content

Instantly share code, notes, and snippets.

View vikrum's full-sized avatar
🎯
Focusing

vikrum vikrum

🎯
Focusing
View GitHub Profile
# -*- 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)
@vikrum
vikrum / index.html
Created September 18, 2017 17:59
HTML stub
<!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 March 3, 2017 17:36
Various One Liners
# 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 January 18, 2017 18:27
Quantopian 401K simplified SPY model; front loaded (4 pay cycles) VS throughout year (26 pay cycles) of $27k
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 June 26, 2012 18:51
Scala REPL exposed via Netty
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.
@vikrum
vikrum / openscad
Created July 20, 2016 19:04
shadow cube
// 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"
@vikrum
vikrum / 95th.py
Created December 31, 2013 21:50
Get 95th percentile from stdin
#!/usr/bin/env python
#
# based on http://stackoverflow.com/a/2753343o
#
# input needs to be presorted
#
import math
import functools
import fileinput
@vikrum
vikrum / pacific-zulu.txt
Created March 28, 2013 01:00
Super lazy mode lookup table for Pacific to Zulu time.
PST PDT GMT
01:00 02:00 09:00
02:00 03:00 10:00
03:00 04:00 11:00
04:00 05:00 12:00
05:00 06:00 13:00
06:00 07:00 14:00
07:00 08:00 15:00
08:00 09:00 16:00
09:00 10:00 17:00
@vikrum
vikrum / probe.sh
Last active December 13, 2015 18:39
Probe SSL server for supported ciphers. (Modified from: http://superuser.com/a/224263/199361 )
#!/usr/bin/env bash
# OpenSSL requires the port number.
SERVER=$1:443
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}