Skip to content

Instantly share code, notes, and snippets.

@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@schmich
schmich / ducky.md
Last active April 5, 2024 14:20
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@frm
frm / Gemfile
Last active September 13, 2016 11:46
A Look Into Bloom Filters with Ruby
source "https://rubygems.org"
gem 'bitarray'
gem 'fnv'
gem 'murmurhash3'
gem 'bloomfilter-rb'
@josh-padnick
josh-padnick / fish-agent.sh
Last active April 1, 2024 06:28
Run ssh-agent via fish shell
#!/bin/bash
#
# Convert ssh-agent output to fish shell
#
eval "$(ssh-agent)" >/dev/null
echo "set SSH_AUTH_SOCK \"$SSH_AUTH_SOCK\"; export SSH_AUTH_SOCK"
echo "set SSH_AGENT_PID \"$SSH_AGENT_PID\"; export SSH_AGENT_PID"
@TroyFletcher
TroyFletcher / vim_tmux_no_X_clipboard.vim
Last active February 8, 2022 21:05
Sharing clipboards between vim and tmux without xsel or xclip or X forwarding
" Share clipboards between vim and tmux without xsel or xclip (which require X and
" X forwarding with SSH) and without changing tmux shortcuts. Requires only tail.
"
" Great for an ssh session to you linode or droplet.
"
" Uses z buffer in vim and writes output to ~/.clipboard and then to tmux's paste
" buffer, and reads it back in cleanly for putting (puddin').
"
" NOTE: tmux has an undocumented command limit! https://github.com/tmux/tmux/issues/254
" this means if you mean to copy larger bits of code (entire functions) tmux will
Tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure && make
package main
const MaxLength = 1 << 20
var (
addr = flag.String("listen", ":8000", "listen for requests")
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start")
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size")
jobs chan Job
@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang
@heyellieday
heyellieday / scraper.rb
Created May 3, 2015 05:56
Medium Web Scraper
require "mechanize"
require "nokogiri"
require 'json'
require "awesome_print"
def get_latest
url = "http://medium.com/@heyellieday"
agent = Mechanize.new { |agent| agent.user_agent_alias = "Mac Safari" }
html = agent.get(url).body
@maxcnunes
maxcnunes / update-coreos-cloud-config.sh
Created February 28, 2015 03:08
Update coreos cloud config
#!/bin/bash
SERVER_IP=<MY_SERVER_IP>
# copy cloud-config.yml to the server
scp cloud-config.yml core@$SERVER_IP:~/
# validate cloud-config file
ssh core@$SERVER_IP "coreos-cloudinit -validate --from-file ~/cloud-config.yml"
if [[ $? == "0" ]]; then