Skip to content

Instantly share code, notes, and snippets.

@korczis
korczis / Surprise
Created March 9, 2012 09:33
What the heck is listening at port 80?
C:\Users\tkorcak>netstat -b -a
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 czh-wk-w7-071:0 LISTENING
[Skype.exe] <---- WTF?
@korczis
korczis / proxy.js
Created March 9, 2012 20:02 — forked from steadicat/proxy.js
A reverse-proxy for CouchDB written in Node.js
#!/usr/local/bin/node
var sys = require('sys');
var http = require('http');
var url = require('url');
var PREFIX = '/db/';
var TARGET = 'http://example.cloudant.com';
var PORT = 8001;
@korczis
korczis / gist:3260246
Created August 4, 2012 22:01
Node.js + Geddy + MongoDB + search (not working)
this.index = function (req, resp, params) {
var self = this;
// Limit in params?
var limit = 100; // default limit
if(params.limit) {
limit = parseInt(params.limit);
}
// Offset in params?
@korczis
korczis / pagination_support.js
Created September 25, 2012 19:49
Ember.PaginationSupport
var get = Ember.get;
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
Ember.PaginationSupport = Ember.Mixin.create({
/**
*/
#! /usr/bin/env ruby
require 'rubygems'
require 'fog'
require 'fileutils'
require 'yaml'
module Apollo
class AwsConsole
<html><body><div class="webkit-line-gutter-backdrop"></div><table><tbody><tr><td class="webkit-line-number"></td><td class="webkit-line-content"><span class="webkit-html-doctype">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;</span><span class="webkit-html-tag">&lt;html&gt;</span><span class="webkit-html-tag">&lt;head&gt;</span><span class="webkit-html-tag">&lt;META <span class="webkit-html-attribute-name">http-equiv</span>="<span class="webkit-html-attribute-value">Content-Type</span>" <span class="webkit-html-attribute-name">content</span>="<span class="webkit-html-attribute-value">text/html; charset=utf-8</span>"&gt;</span><span class="webkit-html-tag">&lt;/head&gt;</span><span class="webkit-html-tag">&lt;body&gt;</span>
</td></tr><tr><td class="webkit-line-number"></td><td class="webkit-line-content">
</td></tr><tr><td class="webkit-line-number"></td><td class="webkit-line-content">
</td></tr><tr><td class="webkit-line-number"></td><td class="webkit-line-content">
</td></tr><t
@korczis
korczis / gist:5569602
Created May 13, 2013 16:27
My books ..
total 559316
-rw------- 1 korczis korczis 159 Oct 13 2011 Woman Her Sex and Love Life-asin_B004UKE2M8-type_EBOK-v_0.ea
-rw------- 1 korczis korczis 335396 Oct 13 2011 Woman Her Sex and Love Life-asin_B004UKE2M8-type_EBOK-v_0.azw
-rw------- 1 korczis korczis 1891 May 25 2012 Woman Her Sex and Love Life-asin_B004UKE2M8-type_EBOK-v_0.apnx
drwx------ 2 korczis korczis 4096 Oct 3 2011 Web
-rw------- 1 korczis korczis 339 Oct 3 2011 Voltaire s Philosophical Diction-asin_B000SN6J6S-type_EBOK-v_0.phl
-rw------- 1 korczis korczis 176 Oct 3 2011 Voltaire s Philosophical Diction-asin_B000SN6J6S-type_EBOK-v_0.ea
-rw------- 1 korczis korczis 320432 Oct 3 2011 Voltaire s Philosophical Diction-asin_B000SN6J6S-type_EBOK-v_0.azw
-rw------- 1 korczis korczis 1104 Apr 29 2012 Voltaire s Philosophical Diction-asin_B000SN6J6S-type_EBOK-v_0.apnx
drwx------ 2 korczis korczis 4096 Jan 19 15:44 UX
===========================================================
REST:
PUT /users/
data = {
username: "korczis",
email: "korczis@gmali.com
}
@korczis
korczis / gist:6057201
Created July 22, 2013 20:10
FQL query to get all photos of all friends
SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo WHERE aid IN
(SELECT aid FROM album WHERE owner IN
(SELECT uid2 FROM friend WHERE uid1=me())
)
AND created > 0 ORDER BY created DESC
require 'koala'
require 'pp'
# Get the token from https://developers.facebook.com/tools/explorer
OAUTH_TOKEN = "SET_YOUR_TOKEN_HERE"
@api = Koala::Facebook::API.new(OAUTH_TOKEN)
profile = @api.get_object("me")
friends = @api.get_connections("me", "friends")
# puts JSON.pretty_generate(friends)