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
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='http://flickrit.com/slideshowholder.php?height=80&size=big&setId=72157648831623920&caption=true&trans=1&theme=1&thumbnails=1&transition=0&layoutType=responsive&sort=0' scrolling='no' frameborder='0'style='width:100%; height:100%; position: absolute; top:0; left:0;' ></iframe>
</div>
@Naramsim
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
Naramsim / ssl_spdy_block
Last active August 29, 2015 14:22
Nginx SSL SPDY server block
server {
listen 80 default_server;
server_name mtgfiddle.me;
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
  • Install meteor
  • meteor build my_app (inside app folder)
  • Move the tar in a web folder and untar it
  • Change /etc/nginx/my_app.com 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
Naramsim / screen.md
Last active October 28, 2015 20:40 — forked from hsuh/screen.md
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).

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

var to_send = {}
to_send.title = "title";
to_send.content = "content";
to_send.author = "aut";
to_send.language = "css";
to_send = JSON.stringify(to_send);
var request = new XMLHttpRequest();
request.open('POST', 'http://localhost:3000/api/v1/new', true);
request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
@Naramsim
Naramsim / Naramsim
Last active June 28, 2016 20:10
Streaks
2015-06-29