Skip to content

Instantly share code, notes, and snippets.

View hrj's full-sized avatar
πŸ”­
observing

hrj hrj

πŸ”­
observing
View GitHub Profile
@hrj
hrj / test.kts
Created February 19, 2015 19:10
Scala v/s Kotlin
var count = 0
var totalTime = 0L
fun test() {
val start = System.currentTimeMillis()
val x = (1L..5000000L) map {it * 40} reduce {a,b -> (a*b)%19 + 1}
val end = System.currentTimeMillis()
@hrj
hrj / sha1check.sh
Created January 9, 2015 12:39
shortcut for sha1sum and check
## call sha1sum and check whether the hash matches
## Syntax: sha1check <hash> <filename>
## Just copy paste the follow line into ~/.zshrc or ~/.bashrc
function sha1check() { echo $1 $2 | sha1sum -c; }
@hrj
hrj / warm.sh
Created July 4, 2014 03:26
warm.sh | A red+green tint effect for the entire screen
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red and green, 50 means half of blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else
@hrj
hrj / followPoints.py
Created October 27, 2013 13:12
Blender script to make an object follow points on a curve
import bpy
import mathutils
C = bpy.context
def insertKeyFrames(obj, curve):
points = curve.data.splines[0].points
duration = curve.data.path_duration
N = len(points)
framesPerPoint = duration / (N-1)
import java.util.Arrays
object Util {
import concurrent._
import ExecutionContext.Implicits.global
def par(f1 : => Unit, f2 : => Unit) {
val fut1 = future { f1 }
val fut2 = future { f2 }
Await.ready(fut1.zip(fut2), duration.Duration.Inf)
}
@hrj
hrj / PropertiesProcessor.xtend
Created September 19, 2013 06:11
@properties annotation for Xtend
package properties
import org.eclipse.xtend.lib.macro.AbstractClassProcessor
import org.eclipse.xtend.lib.macro.Active
import org.eclipse.xtend.lib.macro.TransformationContext
import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration
import static extension properties.ASTExtensions.*
/**
@hrj
hrj / calib.sh
Created September 14, 2013 11:28
Script to add red tint to the entire screen.
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red, 50 means half of green and blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else
@hrj
hrj / matcher.scala
Created August 16, 2013 10:44
Example matcher using Scala Test
def beEqui(to: collection.GenSeq[xml.Node]) = new Matcher[collection.GenSeq[xml.Node]] {
def apply(left: collection.GenSeq[xml.Node]) = {
val flatLeft = flatten(left)
val flatTo = flatten(to)
MatchResult(
flatLeft == flatten(to),
"xmls were not equivalent:\n%s and\n%s" format (flatLeft, flatTo),
"xmls were equivalent:\n%s and\n%s" format (flatLeft, flatTo))
}
@hrj
hrj / brainerd.py
Last active December 20, 2015 20:38 — forked from asmallteapot/brainerd.py
#!/usr/bin/env python
# -*- coding: utf8 -*-
from flask import Flask, redirect, url_for
from markdown import markdown
import os
import re
# create the app
# TODO: load config/template from files, with fallbacks

LogShark is a simple utility to collect logs from an Android device using a PC.

I created this to help Android developers collect information from their app's users. This information can be very useful for debugging purposes.

From Android version 4.1 (Jelly Bean) onwards, it has become difficult to collect this information through the device itself. Hence the need for an app that runs on the PC.

Note that the collection of information is entirely voluntary. Moreover, the user can (and should) review the information before sending it to developers or other people.

Pre-requisites