Skip to content

Instantly share code, notes, and snippets.

View lukaszx0's full-sized avatar

Lukasz Strzalkowski lukaszx0

  • Column
View GitHub Profile
@mackuba
mackuba / configure_project.sh
Last active December 16, 2015 02:59
Creates copies of all example config files in the project and shows them to you in the editor for tweaking/confirmation.
#!/bin/bash
for FILE in $(find config -name '*.sample' -or -name '*.example'); do
COPY=$(echo "$FILE" | sed -E -e 's/\.[^.]+$//')
if [ ! -e "$COPY" ]; then
cp "$FILE" "$COPY"
echo "Created $COPY"
if [ "$EDITOR" ]; then
$EDITOR "$COPY"
@chendo
chendo / gist:5361523
Created April 11, 2013 07:49
Slap this in ~/.ssh/config to route github.com access over SSH via another server to get around routing issues.
Host github.com
ProxyCommand ssh -qxT <ssh server you have access to> nc %h %p
@qrush
qrush / gist:5301799
Created April 3, 2013 14:41
spring clean your git repos!
# remove any bad refs
git remote prune origin
# pipe into bash and auto-delete any branches that have been merged into master!
git log master --pretty=format:'%d' | grep '^ (origin' | tr -d ' ()' | sed 's/origin\//git push origin :/'

This is a proof-of-concept of a couple of concurrent data structures written in Ruby.

The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

@tmm1
tmm1 / rails3_mailer.rb
Created March 27, 2013 23:25
rails3 mailer backport
if Rails.version < '3.0'
require 'mail'
require 'active_support/core_ext/module/attr_internal'
class ActionMailer3
class Collector
attr_reader :responses
def initialize(context, &block)
@context = context
@mislav
mislav / _readme.md
Last active April 24, 2025 10:07
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@steveklabnik
steveklabnik / gist:5171193
Last active December 15, 2015 00:09
Resque roadmap
Rescue 1.x
----------
- Pretty good but has bugs
- used by a LOT of people. (30k)
- fixing issues that are open
- 1.23.x will be the end
- just bugfixes
Resque 2.0
@mislav
mislav / git.md
Last active May 20, 2020 14:52
git merge, reset, rebase, checkout

What I believe is the most confusing thing for git beginners is that the main commands have multiple uses depending on the arguments or context, and some of those uses aren't well-described by the command's name.

Merge

  • merges together different branches (different histories, to be more exact)
  • fast-forwards if a merge isn't necessary; effectively repositioning the branch head to a descendant commit
  • unwanted outcome of git pull

Rebase

@mattetti
mattetti / tracepoint_middlware.rb
Created March 6, 2013 06:34
test middleware for Ruby 2.0 logging the method dispatches going on when a request is being handled.
class TracePoint
class Middleware
def initialize(app)
@app = app
end
def call(env)
stats = {}
trace = TracePoint.new(:call) do |tp|
@paddycarver
paddycarver / retweeted_by.go
Created March 1, 2013 03:42
Find out who retweeted your tweet, sorted by how many followers they have.
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"sort"
"strconv"