Skip to content

Instantly share code, notes, and snippets.

@skayred
skayred / gist:1291051
Created October 16, 2011 15:40
Serialization-deserialization example
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class Main {
public static void main(String[] args) {
Test test = new Test(123, 456);
try {
@skayred
skayred / gist:1295511
Created October 18, 2011 14:11
Client code
package com.skalar;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
public Client(String host, int port) {
@skayred
skayred / gist:1295512
Created October 18, 2011 14:12
Server
package com.skalar;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Window(QWidget):
def __init__(self):
QWidget.__init__(self)
self.points = []
@skayred
skayred / gist:1301664
Created October 20, 2011 17:02
Default image viewer example
package com.jettaxi;
import java.io.OutputStream;
import com.jettaxi.lib.ImageLoader;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
@skayred
skayred / gist:1304511
Created October 21, 2011 18:04
params
key=1214d926a7d6d3c43828969c93237ce7&image=iVBORw0KGgoAAAANSUhEUgAAAlgAAAFGCAIAAAA5MHb9AAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nOzd2ZMj130v+G/uSCABJIACUKiuravYe5NNiVSL5LDttsgrWtfydmOuRr4xjnDEdcyDn/3gR/8FN2Ii5sUvE4qYa48n5sWSNZKuREmUKIlScxFbbFavVV07CkBhXxKJ3ObhdJfbJLJY2QS6gMbvEwpEMXX65EEmgF+ezPM7h1tcXMQoGbX2BDXu7T8udNzI57G+vn7cTXiixv39jlr7+eNuACGEEHKcKBASQgiZaBQICSGETDQKhIQQQiYaBUJCCCETjQIhIYSQiUaBkBBCyETjjit/a9zzxo6r/X75N37tuXjxYq/XazabtVqtUqnUarVWq2Wa5sWLF4fXyCdg3D8/ZDSNWn5bUNT+x0M9QkIIIRONAiEhhJCJRoGQEELIRKNASAghZKJRICSEEDLRKBASQgiZaBQICSGETDRx2DsYl3yvcWnnIXmBfbdrmvZU5hGOS77UoD5Xw36/4/L5Hza/4/C0ft5G7X0d1/GnHiEhhJCJRoGQEELIRKNASAghZKJRICSEEDLRKBASQgiZaBQICSGETDQKhIQQQibawPIIxyUPadzbub+/33f7jRs3Dv5WVVVV1cHu18+g8nvG5bwcFzo+x2vc8/P8jEve5LDbST1CQgghE40CISGEkIlGgZAQQshEo0BICCFkolEgJIQQMtEoEBJCCJloFAgJIYRMNC5ofsy45DNROwkZnmF/bkctj23YxuX9Pq3tpB4hIYSQiUaBkBBCyESjQEgIIWSiUSAkhBAy0SgQEkIImWgUCAkhhEw0CoSEEEIm2tjnEY5ae/yMSzuDelrfFxkv45LfFtS4vK9xbyf1CAkhhEw0CoSEEEImGgVCQgghE40CISGEkIlGgZAQQshEo0BICCFko
@skayred
skayred / gist:1315459
Created October 26, 2011 04:46
foreman log
10:45:21 web.1 | Started POST "/api/trip" for 192.168.192.6 at 2011-10-26 10:45:21 +0600
10:45:21 web.1 | Processing by Api::TripsController#create as HTML
10:45:21 web.1 | Parameters: {"from_address"=>"Address unknown", "from_latlng"=>{"lat"=>30.0, "lng"=>30.0}, "trip"=>{"from_address"=>"Address unknown", "from_latlng"=>{"lat"=>30.0, "lng"=>30.0}, "controller"=>"api/trips", "action"=>"create"}}
10:45:21 web.1 | WARNING: Can't verify CSRF token authenticity
10:45:21 web.1 | * Accept-Language: en_US
10:45:21 web.1 | * Locale set to 'en'
10:45:21 web.1 | * Require login
10:45:21 web.1 | adIFmAV39MMQixbLVj0Z
10:45:21 web.1 | MONGODB taxi_development['system.namespaces'].find({})
10:45:21 web.1 | MONGODB taxi_development['users'].find({:access_token=>"adIFmAV39MMQixbLVj0Z"}).limit(-1).sort([[:_id, :asc]])
16:48:34 web.1 | Started POST "/api/trip" for 192.168.192.7 at 2011-10-26 16:48:34 +0600
16:48:34 web.1 | Processing by Api::TripsController#create as HTML
16:48:34 web.1 | Parameters: {"from_address"=>"ул. Блюхера, 71", "from_latlng"=>{"lat"=>55.126259, "lng"=>61.365738}, "trip"=>{"from_address"=>"ул. Блюхера, 71", "from_latlng"=>{"lat"=>55.126259, "lng"=>61.365738}, "controller"=>"api/trips", "action"=>"create"}}
16:48:34 web.1 | WARNING: Can't verify CSRF token authenticity
16:48:34 web.1 | * Accept-Language: ru_RU
16:48:34 web.1 | * Locale set to 'ru'
16:48:34 web.1 | * Require login
16:48:34 web.1 | c8yQ2nyHnlWiKCqpbXRp
16:48:34 web.1 | MONGODB taxi_development['system.namespaces'].find({})
16:48:34 web.1 | MONGODB taxi_development['users'].find({:access_token=>"c8yQ2nyHnlWiKCqpbXRp"}).limit(-1).sort([[:_id, :asc]])
auto('ToyotaPrius', 'black', number('111', 'aaa'), owner('A', 'B'), '2011/11/11').
auto('NissanNote', 'white', number('222', 'bbb'), owner('C', 'D'), '2010/10/10').
auto('NissanNote', 'white', number('234', 'bcd'), owner('C', 'D'), '2010/10/10').
auto('VAZ 2114', 'purple', number('333', 'ccc'), owner('E', 'F'), '2009/09/09').
auto('VAZ 2113', 'red', number('444', 'ddd'), owner('G', 'H'), '2008/08/08').
auto('VAZ 2112', 'green', number('555', 'eee'), owner('I', 'J'), '2007/07/07').
auto('VAZ 2111', 'brown', number('666', 'fff'), owner('K', 'L'), '2006/06/06').
auto('VAZ 2110', 'none', number('777', 'ggg'), owner('M', 'N'), '2005/05/05').
auto('VAZ 2106', 'silver', number('888', 'hhh'), owner('O', 'P'), '2004/04/04').
auto('VAZ 2105', 'gold', number('999', 'iiii'), owner('Q', 'R'), '2003/03/03').
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.addToBackStack(null);
ft.replace(R.id.details_frag, newFrag);
ft.addToBackStack(null);
ft.commit();