Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

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 / AndroidManifest.xml
Last active Jul 15, 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 / pacific-zulu.txt
Created Mar 28, 2013
Super lazy mode lookup table for Pacific to Zulu time.
View pacific-zulu.txt
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 Dec 13, 2015
Probe SSL server for supported ciphers. (Modified from: http://superuser.com/a/224263/199361 )
View probe.sh
#!/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[@]}
@vikrum
vikrum / Png2Json.java
Created Feb 11, 2013
Quick hack to dump an image to JSON.
View Png2Json.java
package com.firebase.sandbox;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import org.json.JSONObject;
public class Png2Json {
public static void main(String[] args) {
@vikrum
vikrum / sak.sh
Created Feb 4, 2013
Oh, don't mind me, I'm just running roughshod over your processes.
View sak.sh
#!/bin/bash
#
# seek and kill a mem hog fork()'d child
#
SEEK="stud"
SNOOZE="6000"
while [ : ]; do
echo Snoozing for $SNOOZE
@vikrum
vikrum / bandwidth.pl
Last active Dec 11, 2015
display linux interface bandwidths on a regular interval (http://arctic.org/~dean/scripts/bandwidth) Modified to: 1) include aggregates; 2) average packet sizes; and, 3) scaled totals.
View bandwidth.pl
#!/usr/bin/perl -w
# display linux interface bandwidths on a regular interval
# dep: yum -y install perl-Time-HiRes
# Copyright (c) 2005 Dean Gaudet <dean@arctic.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@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
@vikrum
vikrum / gist:4005258
Created Nov 3, 2012
Various distributions of the alphabet
View gist:4005258
var naturalDist = "abcdefghiklmnopqrstuvwxyz";
var scrabbleDist = "aaaaaaaaabbccddddeeeeeeeeeeeeffggghhiiiiiiiiijkllllmmnnnnnnooooooooppqrrrrrrssssttttttuuuuvvwwxyyz";
var englishDist = "aaaaaaaabbcccddddeeeeeeeeeeeefffgghhhhhhiiiiiiijkllllmmnnnnnnnooooooooppqrrrrrrssssssstttttttttuuuvwwwxyyz";
@vikrum
vikrum / twitter-jvm.sh
Created Jul 2, 2012
Twitter's JVM startup template
View twitter-jvm.sh
# Courtesy @marius, April 2012
#
# "Our most common type of system are mostly stateless, high volume,
# low latency RPC systems. For these, we generally use this template:"
HEAP_OPTS="-Xmx17G -Xms17G -XX:NewSize=15G -XX:+UseNUMA"
GC_OPTS="-XX:+UseConcMarkSweepGC -XX:SurvivorRatio=40 -XX:+CMSScavengeBeforeRemark"
GC_LOG_OPTS="-verbosegc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC"
GC_LOG="-Xloggc:/var/log/$APP_NAME/gc.log"
DEBUG_OPTS="-XX:ErrorFile=/var/log/$APP_NAME/java_error%p.log"
@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.
You can’t perform that action at this time.