Skip to content

Instantly share code, notes, and snippets.

View tlatsas's full-sized avatar

Tasos Latsas tlatsas

View GitHub Profile
@tlatsas
tlatsas / notes.js
Last active August 29, 2015 14:22
RethinkDB notes (Data Explorer)
// filter entries with empty 'field1'
r.db('db_name')
.table('test')
.filter(function(search){ return search.hasFields('field1').not() })
.count();
// return only rows that have 'field1' presesent
r.db('db_name')
.table('test')
.hasFields('field1')
@tlatsas
tlatsas / redis.lua
Created November 28, 2014 09:16
code from resty
-- Copyright (C) Yichun Zhang (agentzh), CloudFlare Inc.
local sub = string.sub
local byte = string.byte
local tcp = ngx.socket.tcp
local concat = table.concat
local null = ngx.null
local pairs = pairs
local unpack = unpack
@tlatsas
tlatsas / honeypot.py
Last active August 29, 2015 14:10
returns and logs the request headers
import sys
import json
import logging
from flask import Flask
from flask import request
from flask import Response
# log handler
stdout_logh = logging.getLogger()
@tlatsas
tlatsas / Vagrantfile
Created November 15, 2014 16:30
testing vagrant-docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :test1 do |box|
box.vm.hostname = 'test1'
box.vm.network :forwarded_port, :guest => 9190, :host => 9190
box.vm.provider "docker" do |d|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tlatsas
tlatsas / 2.0.0-p451.patch
Created April 21, 2014 10:59
build ruby with readline 6.3
diff -ur orig/ext/readline/readline.c fixed/ext/readline/readline.c
--- orig/ext/readline/readline.c 2014-03-18 13:53:31.866359527 +0100
+++ fixed/ext/readline/readline.c 2014-03-18 13:56:26.390247250 +0100
@@ -1883,7 +1883,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
@tlatsas
tlatsas / 0_reuse_code.js
Created March 29, 2014 10:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tlatsas
tlatsas / agents
Last active August 29, 2015 13:57
Mange agents with ease
#!/bin/bash
prefix=$(hostname|tr '[:upper:]' '[:lower:]')-$USER
agents=(
"$prefix-agent1"
"$prefix-agent2"
"$prefix-agent3"
"$prefix-agent4"
)
@tlatsas
tlatsas / fosdem_picks.md
Last active February 8, 2017 10:16
My FOSDEM videos picks
#!/bin/bash
#
# Examples:
#
# $ git issue 23358
# $ git issue 23358 -p
issue_id=$1
show_diff=$2