Skip to content

Instantly share code, notes, and snippets.

View kopos's full-sized avatar
🎯
Focusing

Poorna Shashank kopos

🎯
Focusing
View GitHub Profile
sudo apt-get install leiningen
lein install clj-http "0.7.2"
@kopos
kopos / shuffle.py
Last active December 20, 2015 23:18
Shuffle code for shuffling a set of cards http://www.codinghorror.com/blog/2007/12/shuffling.html
import random
import uuid
import hashlib
items = [8, 19, 1, 03, 52, 62, 23, 62, 236, 9, 0, 12]
sorted(items, key=lambda x: hashlib.md5(uuid.uuid1().hex).hexdigest())
@kopos
kopos / command_streaming.php
Created September 4, 2013 15:03
Print the output from a system command unbuffered
<?php
/**
* @func: Executes the command passed to it as argument and prints the
* command console output line by line onto the html output stream hence
* giving the illusion of having the command executing in the html window itself.
*/
function html_exec_cmd($cmd) {
$proc = popen("($cmd)2>&1", "r");
echo '<pre>';
while(!feof($proc)) {
@kopos
kopos / funsvr.scala
Last active December 26, 2015 07:59
Trying to grok funsvr.pdf
/*
* Combinators in Finagle:
*
* - flatMap
* - rescue
* - collect
* - andThen
* -
*/
@kopos
kopos / learning.scala
Created November 5, 2013 12:05
scala tests
// Use as sum(4, 5)
// Use as sum(sum(4, 5), sum(1, 2))
def sum(x: Int, y: Int): Int = {
x + y;
}
// Use as sum(4, 5)
// Use as sum(sum(4, 5), sum(1, 2))
def sum = (x: Int, y: Int) => { x + y; }
@kopos
kopos / borg.py
Created December 24, 2013 09:13
The Borg Design Anti-Pattern Hack
class Borg:
_shared_state = {}
def __init__(self):
self.__dict__ = self._shared_state
b = Borg()
b.name = 'Borg'
c = Borg()
@kopos
kopos / Number to Words
Created June 19, 2016 01:40
Simple data-driven program to convert number to words
def two_digit_words(n):
words = dict([
(1, 'one'),
(2, 'two'),
(3, 'three'),
(4, 'four'),
(5, 'five'),
(6, 'six'),
(7, 'seven'),
(8, 'eight'),
def dynamic_load(fqcn):
parts = [
x.strip()
for x in fqcn.split('.')
if x.strip()
]
module = __import__('.'.join(parts[:-1]),
globals(),
locals(),
[])
@kopos
kopos / distillery-demo.sh
Last active November 17, 2017 07:34
Commands to hot deploy with distillery
git clone https://github.com/wmnnd/distillery-demo.git
cd distillery-demo
# Add distillery as dependency in mix.exs
mix deps.get
# To create the initial release
MIX_ENV=prod mix release.init
MIX_ENV=prod mix release
import frida, sys
native_hook_code = """
Java.perform(function() {
Privilege = Java.user("com.android.engineeringmode.qualcomm.Privilege");
Privilege.escalate.implementation = function(v) {
console.log('escalate Done: ');
return true;
};