Skip to content

Instantly share code, notes, and snippets.

View lukaszkorecki's full-sized avatar
🌴
🛹

Łukasz Korecki lukaszkorecki

🌴
🛹
View GitHub Profile
@lukaszkorecki
lukaszkorecki / receiver.clj
Created June 6, 2017 11:50 — forked from stingh711/receiver.clj
A simple UDP server in clojure
(import '(java.net DatagramSocket DatagramPacket))
(def socket (DatagramSocket. 5200))
(def running (atom true))
(def buffer (make-array Byte/TYPE 1024))
(defn parse [packet]
(println (String. (.getData packet) 0 (.getLength packet))))
(defn start-receiver []
@lukaszkorecki
lukaszkorecki / server.clj
Created December 30, 2015 21:11 — forked from drbobbeaty/server.clj
Simple clojure Ring example
(ns performance.server
"The routes for the web server."
(:require [cheshire.core :as json]
[clj-time.core :refer [now]]
[clojure.tools.logging :refer [infof warn warnf error errorf]]
[compojure
[core :refer [defroutes GET POST]]
[handler :as handler]]
[ring.middleware.jsonp :refer [wrap-json-with-padding]]
[ring.middleware.params :refer [wrap-params]]
es_alias = ENV.fetch('ALIAS')
hosts = ENV.fetch('HOSTS')
old_index = ENV.fetch('OLD_INDEX')
old_type = ENV.fetch('OLD_TYPE')
new_index = ENV.fetch('NEW_INDEX')
new_type = ENV.fetch('NEW_TYPE')
size = ENV.fetch('SCAN_SIZE', 100)
client = Elasticsearch::Client.new(hosts: hosts)
unless client.indices.exists(index: new_index)
// Hover.com "Zone file import/export" has been *Planned* since 2011
// https://help.hover.com/entries/471066-Zone-file-import-export
// Here's a brittle approximation of export.
//
// 1. login to your account: https://www.hover.com/domains
// 2. run the following in your browser's JavaScript console, changing the first line
// to your domain
// 3. copy the text logged to the console.
// 4. manually correct FQDNs, these have to end with a period "."
//
ORIGINAL_JENKINS_SERVER=
ORIGINAL_SERVER_USER=
NEW_JENKINS_SERVER=
NEW_SERVER_USER=
# ON THE ORIGINAL JENKINS SERVER
ssh $ORIGINAL_SERVER_USER@$ORIGINAL_JENKINS_SERVER
cd /var/lib/jenkins/
for i in `ls jobs`; do echo "jobs/$i/config.xml";done > config.totar
@lukaszkorecki
lukaszkorecki / NoNils
Last active August 29, 2015 14:12 — forked from plcstevens/Results
Rehearsal ---------------------------------------------
any? 1.270000 0.010000 1.280000 ( 1.285305)
all? 0.870000 0.000000 0.870000 ( 0.880658)
min block 1.270000 0.010000 1.280000 ( 1.284267)
smart ass 0.670000 0.010000 0.680000 ( 0.689223)
------------------------------------ total: 4.110000sec
user system total real
any? 1.240000 0.010000 1.250000 ( 1.258006)
all? 0.880000 0.010000 0.890000 ( 0.890891)
@lukaszkorecki
lukaszkorecki / file_notifier.rb
Created March 22, 2012 22:04 — forked from jugyo/event_notifier.rb
file_notifier.rb
# Writes number of "unread" tweets to a file
# so that it can be used in tmux' status bar, like so:
#
# tail -1 ~/.earthquake_count
#
# You can reset the counter with :reset_count command
class NotiFile
def initialize file_path
log "new NotiFile"
@file = File.expand_path file_path
@lukaszkorecki
lukaszkorecki / README.md
Created March 16, 2012 11:47 — forked from gabrielfalcao/README.md
Homebrew formula for nginx with the tcp socket proxy module already enabled
@lukaszkorecki
lukaszkorecki / run_tags.rb
Created August 9, 2011 09:45 — forked from dougcole/run_tags.rb
A script for generating TAGS from a git hook. Puts tags file to .git dir so that fugitive.vim can detect it. Also uses 'which' for detecting ctags bin location
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = `which ctags`.chomp
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
@lukaszkorecki
lukaszkorecki / Coffeescript ctags
Created May 6, 2011 09:04 — forked from mads-hartmann/Coffeescript ctags
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*->.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/