Skip to content

Instantly share code, notes, and snippets.

View pawelkl-zz's full-sized avatar

Paweł Kłosiewicz pawelkl-zz

View GitHub Profile
#!/usr/bin/env zsh
function usage() {
cat <<EOF
USAGE i3-xephyr start|stop|restart|run
start Start nested i3 in xephyr
stop Stop xephyr
restart reload i3 in xephyr
run run command in nested i3
EOF
@benkaiser
benkaiser / config
Created February 5, 2014 11:59
Scripts to get i3 dynamic tagging working
# Just add the following lines to your i3 config file
# dynamic tagging feature
bindsym $mod+t exec ~/.i3/get_workspace_options.py | dmenu -b | ~/.i3/go_to_workspace.py
bindsym $mod+Shift+t exec ~/.i3/get_workspace_options.py | dmenu -b | ~/.i3/move_to_workspace.py
anonymous
anonymous / node_dos.rb
Created October 19, 2013 01:07
require "socket"
require "uri"
url = URI.parse(ARGV.first || abort("Usage: node_dos.rb <url>"))
sock = TCPSocket.new(url.host, url.port)
loop do
sock.write "GET / HTTP/1.1\r\n\r\n"
end
@trustin
trustin / pavol.sh
Created June 13, 2013 07:43
Volume control script for PulseAudio
#!/bin/bash
SINK="`pactl info | grep -P '^Default Sink: ' | sed 's/[^:]\+:\s\+//'`"
[[ -z "$SINK" ]] && exit 1
if [[ "$SINK" =~ DragonFly ]]; then
INCR='24'
MIN_VOLUME=65050
MAX_VOLUME=65146
else
INCR='2%'
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@victorporof
victorporof / config.fish.sh
Last active July 18, 2022 08:59
config.fish
# Enviroment setup
# Path vars
set -gx PATH /usr/local/bin /usr/bin /bin /usr/local/sbin /usr/sbin /sbin
set -gx PATH /opt/homebrew/bin $PATH
set -gx PATH $PATH $HOME/.local/bin
set -gx PATH $PATH $HOME/.cargo/bin
set -gx PATH $PATH $HOME/.yarn/bin
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@narze
narze / Default (OSX).sublime-keymap
Created July 10, 2012 12:36
My Sublime Text 2 Key bindings (some macros and packages required)
[
{ "keys": ["alt+;"], "command": "run_macro_file", "args": {"file": "Packages/User/Semicolon EOL.sublime-macro"} },
{ "keys": ["alt+["], "command": "run_macro_file", "args": {"file": "Packages/User/{} EOL.sublime-macro"} },
{ "keys": ["alt+,"], "command": "run_macro_file", "args": {"file": "Packages/User/Colon EOL.sublime-macro"} },
{ "keys": ["alt+end"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["super+;"], "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} },
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof", "extend": false} },
# Useful aliases {{{
alias c 'clear'
alias hl 'less -R'
alias paththis 'set PATH (pwd) $PATH'
alias ef 'vim ~/.config/fish/config.fish'
# }}}
# Environment variables {{{
@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'