Skip to content

Instantly share code, notes, and snippets.

View Naramsim's full-sized avatar
Always in Christmas mood

Alessandro Pezzè Naramsim

Always in Christmas mood
View GitHub Profile
Naramsim / FlickrShow
Last active August 29, 2015 14:11
Flickr SlideShow
<div style='position: relative; padding-bottom: 81%; height: 0; overflow: hidden;'>
<iframe id='iframe' src='' scrolling='no' frameborder='0'style='width:100%; height:100%; position: absolute; top:0; left:0;' ></iframe>
Naramsim / fastPow.cpp
Created January 28, 2015 20:45
fastest rewrite of pow(..,2)
float f=...
if (*(int*)&f & 0x7FFFFFFF) {
*(int*)&f += n << 23;
Naramsim / ssl_spdy_block
Last active August 29, 2015 14:22
Nginx SSL SPDY server block
server {
listen 80 default_server;
return 301 https://$server_name$request_uri;
server {
access_log /var/log/nginx/access_log combined;
sudo apt-get install build-essential python-dev libmysqlclient-dev
sudo pip install virtualenv
mkdir dbfiller
cd dbfiller/
virtualenv env
# env/bin/pip install MySQL-python #best for now to use sqlite3
chmod -R a+rx var/log/nginx/
rsync -ah --progress source destination

Flush RAM and buffers free && sync && echo 3 > /proc/sys/vm/drop_caches && free

Get process who are consuming RAM ps aux --sort -rss

Get process tree ps axjf

Kill process by name

  • Install meteor
  • meteor build my_app (inside app folder)
  • Move the tar in a web folder and untar it
  • Change /etc/nginx/ to proxypass to localhost:3000
  • Reload nginx
  • Install node and mongodb(binary)
  • Start mongod with --smallfiles and &(or screen)
  • ./mongod --smallfiles --fork --logpath /var/log/mongod.log
  • move in bundle folder
  • Install the app (cd programs/server &amp;&amp; npm install)
Naramsim /
Last active October 28, 2015 20:40 — forked from hsuh/
screen spliting with screen

In screen the terminal multiplexer.

  • new session screen -S NewSession
  • switch between sessions ctrl a then n
  • detach to the current session ctrl a then d
  • list screens screen -ls
  • attach to an attached session screen -x pidOfSession
  • delete detached session screen -X -S pidOfSession quit
  • To split vertically: ctrl a then |.
  • To split horizontally: ctrl a then S (uppercase one).
  • To unsplit: ctrl a then Q (uppercase one).
var to_send = {}
to_send.title = "title";
to_send.content = "content"; = "aut";
to_send.language = "css";
to_send = JSON.stringify(to_send);
var request = new XMLHttpRequest();'POST', 'http://localhost:3000/api/v1/new', true);
request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');