Skip to content

Instantly share code, notes, and snippets.

View l1x's full-sized avatar
🏠
Working from home

Istvan l1x

🏠
Working from home
View GitHub Profile
@l1x
l1x / find.rb
Created March 28, 2011 20:56
Find and list files+ directories recursively
require 'find'
class MyCloudFiles
def initialize
end
def find_files(dir)
Find.find(dir) { |f|
p f
a=[1,1,2] b=[4,5,6] c=[2,3,4]
#kivalasztasz random nodeot
#legyen most b
#kivalasztod b node random elemet, legyen 4
#mindegyik nodenak elkuldod hogy adja vissza a nagyobb es a kisebb elemeket 4 nel
a b c szum
kisebb 3 0 2 5
nagyobb 0 2 0 2
require 'zlib'
require 'pp'
require 'logger'
# original seen on http://www.igvita.com/2011/04/20/intuition-data-driven-machine-learning/
$log = Logger.new(STDOUT)
$log.level = Logger::WARN
class CompareFiles
attr_reader :pairs
try {
//data=json...
URL url = new URL("http://couch.nohup.hu/nohup_urls");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
@l1x
l1x / os_mon.erl
Created October 16, 2011 21:52
os_mon
application:start(sasl).
application:start(os_mon).
cpu_sup:nprocs().
cpu_sup:avg1().
cpu_sup:avg5().
cpu_sup:avg15().
memsup:get_check_interval().
memsup:get_sysmem_high_watermark().
@l1x
l1x / gist:1291476
Created October 16, 2011 21:54
linux memory rss, vsz
ps -eorss,vsz,pid,tt,user,fname,tmout,f,wchan | sort -n
@l1x
l1x / gist:1316743
Created October 26, 2011 15:43
erlang http post
1> inets:start().
ok
2> http:request(post, {"http://www.google.com/",[],"application/x-www-form-urlencoded", "hl=en&q=erlang&btnG=Google+Search&meta="},[], []).
{ok,{{"HTTP/1.1",405,"Method Not Allowed"},
[{"date","Wed, 26 Oct 2011 15:40:10 GMT"},
{"server","gws"},
{"allow","GET, HEAD"},
{"content-length","11816"},
{"content-type","text/html; charset=UTF-8"},
@l1x
l1x / gist:1316791
Created October 26, 2011 15:54
async http request
2> {ok, RequestId} = httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).
{ok,#Ref<0.0.0.38>}
3> receive {http, {RequestId, Result}} -> ok after 500 -> error end.
ok
@l1x
l1x / .bashrc
Created February 5, 2012 02:08
.bashrc
# .bashrc
# User specific aliases and functions
export PS1="\u@\h:"
export EDITOR=vim
export HISTFILESIZE=100000000000000000
export HISTCONTROL=ignoredups
# shopt set
@l1x
l1x / more.vimrc
Last active December 14, 2020 07:27
.vimrc
colorscheme slate
filetype on
syntax on
set autochdir
set autoindent
set bs=indent,eol,start
set expandtab
set guioptions=ic
set hidden