Skip to content

Instantly share code, notes, and snippets.

View eaorak's full-sized avatar
💭
I'd rather be here and now.

ender eaorak

💭
I'd rather be here and now.
View GitHub Profile
@eaorak
eaorak / tureng.py
Last active November 23, 2015 13:01
Python - Console Dictionary for tureng.com
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Basic dictionary script that parses results from tureng.com - EAO
import sys
import urllib2
from BeautifulSoup import BeautifulSoup
try:
@eaorak
eaorak / sss.py
Created October 11, 2012 07:38
Python - Screen Saver "Saver" Script
#!/usr/bin/python
# This script prevents screen saver get activated by moving mouse periodically.
# EAO-09.2012
import win32api, time
print "Die screensaver !"
dif=1
exc=False
while True:
try:
@eaorak
eaorak / tictactoe.py
Created October 27, 2012 21:18
Python - TicTacToe Game
#!/usr/bin/python3
# Simple TicTacToe game in Python - EAO
import random
import sys
board=[i for i in range(0,9)]
player, computer = '',''
# Corners, Center and Others, respectively
moves=((1,7,3,9),(5,),(2,4,6,8))
@eaorak
eaorak / caesar_cipher.py
Created October 30, 2012 16:12
Python - Caesar Cipher
#!/usr/bin/python3
# Caesar Cipher
LEN,UP_MIN,LOW_MIN = 26,65,97
def getchar(ch, key, enc):
if not ch.isalpha():
return ch
key = key if enc else -key
(min,max) = (UP_MIN, UP_MIN+LEN) if ch.isupper() else (LOW_MIN, LOW_MIN+LEN)
@eaorak
eaorak / hangman.py
Created October 31, 2012 09:59
Python - Hangman Game
#!/usr/bin/python3
# Hangman game
import random
class HangMan(object):
# Hangman game
hang = []
hang.append(' +---+')
@eaorak
eaorak / RoundArray.java
Created October 31, 2012 12:44
Java - RoundArray<T>
package us.elron.utils.cache;
import java.lang.reflect.Array;
import java.util.Arrays;
/*
RoundArray can hold a "window" of values, oldest values are removed from
the array when new ones are added. It also supports console based simple
visualization.
*/
@eaorak
eaorak / InfoShortener.java
Last active December 14, 2015 17:59
Information shortener, can be used for shorten info like urls.
/**
* Abstract generic info shortener that can be modified
* to generate short ids for desired classes.
*
* @author eaorak
*/
public abstract class InfoShortener<T> {
private static int ALPCNT = 62;
private static String cstr = new String();
@eaorak
eaorak / Size
Created January 16, 2014 13:05
Useful enum for file size calculations.
/**
* Useful for disk file size calculations. [eaorak]
*/
public enum Size {
BY, // Bytes
KB, // Kilo
MB, // Mega
GB, // Giga
TB, // Tera
@eaorak
eaorak / PerformanceRelated.txt
Last active December 6, 2015 22:25 — forked from neomatrix369/PerformanceRelated.md
Interesting links in the areas of HPC, low latency, mechanical harmony/sympathy, garbage collection
Everything I Ever Learned About JVM Performance Tuning @Twitter- by Attila Szegedi
http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter (video & slides)
9 Fallacies of Java Performance - by Ben Evans
http://www.infoq.com/articles/9_Fallacies_Java_Performance (video & slides)
Visualizing Java GC - by Ben Evans
http://www.infoq.com/presentations/Visualizing-Java-GC (video & slides)
@eaorak
eaorak / gist:1ac27dd38809acdcc17d
Created January 10, 2016 18:28 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name