Skip to content

Instantly share code, notes, and snippets.

@fatihky
fatihky / jquery.watch.js
Created March 23, 2014 12:37
jQuery watch div
function watch(selector, ms, cb)
{
var last_val = $(selector).html();
var interval = setInterval(function(){
var curr_val = $(selector).html();
if(curr_val != last_val)
{
last_val = curr_val;
if(cb) cb();
}

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

I installed Statsd on Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-48-virtual x86_64)
Get node (i think that the repo for it changed so check out a different way to install)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-software-properties git-core
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@fatihky
fatihky / async-test.c
Last active August 29, 2015 14:03
async redis with G-WAN (work in progress now)
// ============================================================================
// C servlet sample for the G-WAN Web Application Server (http://trustleap.ch/)
// ----------------------------------------------------------------------------
// async-test.c: G-WAN async operations test
// ============================================================================
#include "gwan.h" // G-WAN exported functions
#include <hiredis/adapters/libev.h>
#include <hiredis/async.h>
#include <unistd.h>
#include <string.h>
#!/bin/bash
echo gcc -I/usr/include/lua5.1/ -L/usr/local/lib/ -llua -o call_lua{,.c} -llua -ldl -lm
gcc -I/usr/include/lua5.1/ -L/usr/local/lib/ -llua -o call_lua{,.c} -llua -ldl
module.exports = ()->
S = this
if(!S.lobi)
null
c.lrange 'okey:' + S.lobi + ':odalar', 0, -1, (h, s)->
if(h)
false
if(s.length == 0)
@fatihky
fatihky / ornek.js
Last active August 29, 2015 14:04
socket.io yerine kullanmak üzere geliştirdim... şu gerekli: http://visionmedia.github.io/uikit/
var s = new Soket("ws://echo.websocket.org");
s.on("mesaj", function(mesaj)
{
console.log("sunucudan gelen mesaj: " + mesaj);
});
s.emit("mesaj", "Deneme mesaj");
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE