This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python2 | |
import cv2 | |
import numpy as np | |
from collections import deque | |
orig_image = None | |
gray_image = None | |
threshold_image = None | |
edge_image = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
private static boolean isPalindrome (String string) { | |
String reversedString = new StringBuilder(string).reverse().toString(); | |
for (int i =0; i < string.length() / 2; i++) { | |
if (string.charAt(i) != reversedString.charAt(i)) | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn palindrome? [string] | |
"Check whether a given string is a palindrome." | |
(loop [string string | |
start 0 | |
end (dec (count string))] | |
(cond | |
;;compare string's start and string's end | |
(not (= (get string start) (get string end))) false | |
;; return true after checking middle char | |
(<= end start) true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn combinations [lst k] | |
(letfn [(combinator [x xs] | |
(if (= (count x) k) | |
[x] | |
(when (not (empty? xs)) | |
(concat (combinator (concat x [(first xs)]) (rest xs)) | |
(combinator x (rest xs))))))] | |
(combinator nil lst))) | |
;; user> (combinations (range 1 6) 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Thura Hlaing <trhura@gmail.com> | |
# Time-stamp: <2013-11-08 12:11:30 (trhura)> | |
# script to parse startup infos from https://api.angel.co/1/startups?filter=raising and | |
# save it into a csv file. | |
__author__ = "Thura Hlaing <trhura@gmail.com>" | |
import csv | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# How to run this program: python3 twittersort.py tweet1.py tweet2.py | |
# Implementation for CS150 project 2 (http://troll.cs.ua.edu/cs150/projects/index.html) | |
__author__ = "Thura Hlaing <trhura@gmail.com>" | |
import sys | |
from collections import namedtuple | |
from scanner import Scanner | |
from pprint import pprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Author: Thura Hlaing <trhura@gmail.com> | |
# Time-stamp: <2013-08-29 16:13:36 (trhura)> | |
import os | |
import csv | |
from django.core.management.base import BaseCommand, CommandError | |
from django.db.models.loading import get_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# script for ubnt device discovery | |
# Usage: python discover.py or ./discover.py | |
import socket | |
from contextlib import closing | |
PORT=40860 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# A small script for cdp devices discovery | |
import sys | |
import pcapy | |
import socket | |
from dpkt import ethernet | |
from dpkt import cdp | |
from docopt import docopt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/neo') | |
# Greed is a dice game where you roll up to five dice to accumulate | |
# points. The following "score" function will be used to calculate the | |
# score of a single roll of the dice. | |
# | |
# A greed roll is scored as follows: | |
# | |
# * A set of three ones is 1000 points | |
# |