Skip to content

Instantly share code, notes, and snippets.

View xenji's full-sized avatar

Mario Mueller xenji

  • Mettmann, Germany
  • 16:29 (UTC +02:00)
View GitHub Profile
@xenji
xenji / update_tunnelbroker.rb
Created February 21, 2013 08:16
This is a simple script that I run on my raspberry-pi to update my public WAN IPv4 at tunnerbroker.net. Most of the script is configurable so you might use it for other providers with low effort.
#!/usr/bin/env ruby
require 'net/http'
require 'net/https'
BASEDIR = '/etc'
LAST_IP_FILE = "#{BASEDIR}/tunnelbroker.lastip"
# for debugging.
BE_VERBOSE = false
var Search = {
searchUrl: "http://search.xenji.com/xenjicom/_search",
processResults: function(results) {
if (typeof results != "undefined")
this.renderResults(results.hits);
},
onkeypress: function(event) {
require 'tire'
require 'sanitize'
module Jekyll
class ElasticSearchIndexer < Generator
safe true
def generate(site)
Tire::Configuration.url(site.config['search_server'])
require "mongo"
require 'json'
connection = Mongo::Connection.new("localhost", 27017)
db = connection.db('log_201208')
col = db.collection('d_01')
col.create_index([['ts', Mongo::ASCENDING], ['pid', Mongo::DESCENDING]])
col.create_index('status')
entries = Atom::Feed.load_feed(URI.parse("https://speakerdeck.com/u/xenji.atom"))
base_url = "https://speakerdeck.com"
path = "/oembed.json?url="
@embeds = []
entries.each_entry do |entry|
link = entry.links.alternate.to_s.sub "https", "http"
fullpath = path + CGI.escape(link)
uri = URI.parse(base_url + fullpath)
@xenji
xenji / gist:2889392
Created June 7, 2012 15:24
My config.fish
set git_branch_color green
set mycolor 875f5f
function headrev
echo (git log --pretty=%h -n 1)
end
function __git_ps1
set -l g (git rev-parse --git-dir ^/dev/null)
@xenji
xenji / git_bash_ps1.sh
Created April 3, 2012 14:17
My git bash ps1
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
Quercus q;
QuercusEngine qce = new QuercusEngine();
qce.getQuercus().init();
FilePath executableFile = new FilePath(cmdLine[7].replace("\"", ""));
// Set the ini path
qce.getQuercus().setIniFile(new FilePath(cmdLine[3]));
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
@xenji
xenji / compile_flags.txt
Created March 7, 2012 11:01
Compile flags for xcache and memcache for php5.4.0
CFLAGS="-D_REENTRANT -D_THREAD_SAFE -O3 -pipe -pthread" CXXFLAGS="-D_REENTRANT -D_THREAD_SAFE -O3 -pipe -pthread" ./configure
package main
import ("os";"runtime")
func main() {
var aFromList [2]string= [2]string{"/tmp/checkout/folder1_new","/tmp/checkout/folder2_new"}
var aToList [2]string = [2]string{"/var/www/folder1","/var/www/folder2"}
runtime.GOMAXPROCS(2)
c := make(chan int)