Skip to content

Instantly share code, notes, and snippets.

View hkdsun's full-sized avatar
❤️
Spreading love

Hormoz Kheradmand hkdsun

❤️
Spreading love
View GitHub Profile
object Calculator {
def props = Props(new Calculator)
}
class Calculator extends Actor{
val log = Logging(context.system, this)
context.watch(sender)
def receive = {
case Matrix(rows) => {
sender ! rows.flatten.sum
@hkdsun
hkdsun / gist.rb
Created April 19, 2016 13:05
ruby heredoc/multiline string with space and newlines stripped
warn(<<-EOF.gsub(/^\s+/, '').gsub(/\n/, ' '))
xxxxxxxxxxxxxxxxxxxxx
#xxxxxxxxx
xxxx xxxx xxxx xxxx
EOF
# USAGE
# python ball_tracking.py --video ball_tracking_example.mp4
# python ball_tracking.py
# import the necessary packages
from collections import deque
import numpy as np
import argparse
import imutils
import cv2
private ConcurrentHashMap<String, TNonblockingTransport> open_connections = new ConcurrentHashMap<String, TNonblockingTransport>();
private ConcurrentHashMap<String, KeyValueService.AsyncClient> open_clients = new ConcurrentHashMap<String, KeyValueService.AsyncClient>();
private TNonblockingTransport getConnection(Integer server) throws TException, IOException {
String threadKey = server.toString() + Thread.currentThread().getId();
if(open_connections.containsKey(threadKey))
return open_connections.get(threadKey);
String host = StorageNode.hosts.get(server);
Integer port = StorageNode.ports.get(server);
#!/bin/bash
queue_file='/tmp/nbody.queue'
cmd="./test_cmd"
lock_file="/tmp/nbody.lock"
remove_first_in_queue() {
tail -n +2 "$queue_file" > "$queue_file.tmp" && mv "$queue_file.tmp" "$queue_file"
}
@hkdsun
hkdsun / bitgit.sh
Created April 20, 2017 12:01
Create and push Bitbucket repository from your terminal
#!/bin/bash
function ask() {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
diff --git c/DEBIAN/config w/DEBIAN/config
index 85ed5fd..116aa19 100755
--- c/DEBIAN/config
+++ w/DEBIAN/config
@@ -3,7 +3,7 @@
#'alternatives'. This sets the java as default, and you can switch your
#default java with update-java-alternatives
#
-#Copyright 2012 Bruce.Ingalls at gmail & Alin Andrei <webupd8@gmail.com>
+#Copyright 2017 Bruce.Ingalls at gmail & Alin Andrei <webupd8@gmail.com>
#!/usr/bin/env ruby
require 'yaml'
def get_inward_dependencies_from(filename, pkg)
shitlist = YAML.load_file(filename)
shitlist[pkg]
end
def save_to_file(pkg, aggregate)
# Use vim bindings
setw -g mode-keys vi
set-option -g default-shell /bin/zsh
# unbind-key -a
unbind C-m
unbind C-b
unbind C-a
-- paths.lua
local hardlink_cmd = "cp -val"
local mv_cmd = "mv"
local function split(source, sep)
local result, i = {}, 1
while true do
local a, b = source:find(sep)
if not a then break end