Skip to content

Instantly share code, notes, and snippets.

View mickeypash's full-sized avatar
🐢
slow and steady wins the race

Mickey Pashov mickeypash

🐢
slow and steady wins the race
View GitHub Profile
@mickeypash
mickeypash / JavaC.sublime-build
Created January 26, 2015 20:02
Run and Compile Java from SublimeText 2
{
"cmd": ["javac", "-Xlint", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"variants": [
{ "cmd": ["javac", "-Xlint", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
@mickeypash
mickeypash / histp
Created January 30, 2015 19:03
Self explanatory
#!/bin/sh
#
# Displays your top 10 most used commands
#
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
@mickeypash
mickeypash / writeFileBytesBuffered.java
Created February 5, 2015 21:37
Buffered writer in Java
void writeFileBytesBuffered(String filename, String content) {
try {
BufferedWriter writer =
Files.newBufferedWriter(
FileSystems.getDefault().getPath(".", filename),
Charset.forName("US-ASCII"),
StandardOpenOption.CREATE);
writer.write(content, 0, content.length());
}
@mickeypash
mickeypash / stack-trace.java
Created February 10, 2015 20:32
problem with removing Referees
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at JavaBallController$RefereeTableModel.getValueAt(JavaBallController.java:374)
at javax.swing.JTable.getValueAt(JTable.java:2717)
at javax.swing.JTable.prepareRenderer(JTable.java:5706)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2114)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2016)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1812)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
@mickeypash
mickeypash / slug.md
Last active August 29, 2015 14:15
what is a slug

slug A short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs. For example, in a typical blog entry URL:

https://www.djangoproject.com/weblog/2008/apr/12/spring/

the last bit (spring) is the slug.

@mickeypash
mickeypash / aliases.sh
Created February 26, 2015 20:13
separating out my aliases from my .profile
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
@mickeypash
mickeypash / .aliases
Created February 27, 2015 20:54
my aliases so far
# Aliases
# --------
# Projects
alias ipy="python -i $1"
alias prof="subl ~/.profile"
alias spy="cd ~/Documents/scripts/"
alias itech="cd ~/Documents/itech-team-pamm && workon itech-team-pamm"
alias tp="cd ~/Documents/workspace/AE4 && git pull"
alias socs="ssh 1005139p@sibu.dcs.gla.ac.uk -L 8080:webapps.dcs.gla.ac.uk:443"
@mickeypash
mickeypash / lab-exam-q3.txt
Last active August 29, 2015 14:16
suggested way of calculating the number of files
Lab exam for calculating the number of files and folders in a file system
http://sourcemaking.com/design_patterns/Composite/java/1
interface FileComponent
+ calculateTotal();
FileComposite
+ calculateTotal()
for item in composite
total += leaf.calculateTotal();
@mickeypash
mickeypash / brew-list.txt
Last active August 29, 2015 14:18
A list of my currently install packages
archey About this Mac in terminal form
brew-cask homebrew-style CLI workflow for the administration of Mac applications distributed as binaries.
cmatrix Matrix animation in your terminal (oldie but goodie)
gawk makes it possible to handle simple data-reformatting jobs with just a few lines of code
gibo
git Apple's git is outdated, this allows you to have the news git
git-flow A set of git extensions to provide high-level repository operations
gmp
go Go is a tool for managing Go source code.
htop-osx
@mickeypash
mickeypash / Main.java
Created April 9, 2015 21:15
Google Code Jam Winning solution Round 3 - Magical, Marvelous Tour
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.Arrays;