Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Vikrum vikrum

🎯
Focusing
View GitHub Profile
View aws-console-actions.json
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now/m-1m",
"lt": "now/m"
}
}
@vikrum
vikrum / .osx
Last active Aug 4, 2020
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
View aws-prefixes.txt
a4b
accessanalyzer
acm
acm-pca
alexaforbusiness
amplify
api
apigateway
apigatewaymanagementapi
apigatewayv2
@vikrum
vikrum / AndroidManifest.xml
Last active Dec 31, 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):
You can’t perform that action at this time.