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 / 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;
@mickeypash
mickeypash / Decorator pattern.java
Created April 25, 2015 20:49
Decorator pattern from AP 2015 Simon's example
// the first step is to define an abstract
// class that both BasicCar and our decorators will extend
public abstract class Car {
public abstract double getPrice();
public abstract String getDescription();
}
public class BasicCar extends Car{
public double getPrice() {
@mickeypash
mickeypash / Visitor pattern.java
Created April 25, 2015 20:50
Visitor pattern AP 2015 Simon's example
// MyElement only implements the accept method and this just called the visit method of MyVisitor
public interface MyElement {
public void accept(MyVisitor visitor);
}
import java.util.Calendar;
public class Human implements MyElement {
public Calendar dOB;
public Human(Calendar d) {
dOB = d;
@mickeypash
mickeypash / Client-Server.java
Created April 26, 2015 13:03
Client-Server AP 2015 Simon's example
public class Server {
private static int PORT = 9000;
public static void main(String[] args){
ServerSocket listener = new ServerSocket(PORT);
Socket client = listener.accept();
PrintWriter out = new PrintWriter(client.getOutputStream(), true);
@mickeypash
mickeypash / DateServer3.java
Last active August 29, 2015 14:19
DateServer3 AP 2015 Simon's example
import java.io.*;
import java.net.*;
import java.util.Date;
public class DateServer3 {
private static int PORT = 8765;
private static ServerSocket listener;
public static void main(String[] args) {
try {
listener = new ServerSocket(PORT);
while(true) {
@mickeypash
mickeypash / DateClient3.java
Created April 26, 2015 13:18
DateClient3 AP 2015
import java.net.*;
import java.io.*;
public class DateClient3 {
private static String server = "127.0.0.1";
private static int PORT = 8765;
public static void main(String[] args) throws IOException{
//Create the socket, a reader and a writer
Socket socket = new Socket(server,PORT);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
/* Note that the writer helps the server
-- 17. Get the names of people, who live at the same address
SELECT fname, sname, address
FROM Member
WHERE address = (SELECT address
FROM Member
GROUP BY address HAVING COUNT(address) > 1);
@mickeypash
mickeypash / phone-issues.md
Created May 16, 2015 14:57
Problems with my Samsung Galaxy S3
@mickeypash
mickeypash / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mickeypash
mickeypash / python_resources.md
Last active August 29, 2015 14:25 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides