Skip to content

Instantly share code, notes, and snippets.

View bavovna's full-sized avatar

bavovna

View GitHub Profile
~ > cat .hammerspoon/init.lua
# activate / deactivate kitty
hs.hotkey.bind({"ctrl", "shift"}, "`", function()
local app = hs.application.get("kitty")
if app then
if not app:mainWindow() then
app:selectMenuItem({"kitty", "New OS window"})
elseif app:isFrontmost() then
app:hide()
else
@bavovna
bavovna / main.rs
Created December 31, 2020 07:15
lookup your IP in rust
mod rxx;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let v = rxx::my_ip()?;
println!("{}", v); // println!("{:#?}", v);
Ok(())
}
@bavovna
bavovna / termination_state.txt
Created September 30, 2020 19:26
HAProxy termination_state
From https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.5
Session state at disconnection
TCP and HTTP logs provide a session termination indicator in the
"termination_state" field, just before the number of active connections. It is
2-characters long in TCP mode, and is extended to 4 characters in HTTP mode,
each of which has a special meaning :
- On the first character, a code reporting the first event which caused the
@bavovna
bavovna / autonomous.txt
Created May 15, 2020 04:35 — forked from benjamincharity/autonomous.txt
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@bavovna
bavovna / download_megaraid.sh
Created September 21, 2015 16:52
Download MegaRAID utils
#!/bin/bash
set -x
set -e
yum -y install net-snmp net-snmp-utils
yum -y install wget vim csh
mkdir megaraid
cd megaraid
wget http://docs.avagotech.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/MSM_linux_x64_installer-15-05-01-00-tar.gz
import sys
from subprocess import Popen, PIPE
def git_history(commit_from, commit_to):
cmd=["git", "log", "--pretty=oneline", "--grep", "'[[:digit:]]\{2,\}'", "--grep", "'issue\|feature\|bug'", "--max-parents=1", "{}...{}".format(commit_from, commit_to)]
cmd = " ".join(cmd)
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
return p.communicate()
@bavovna
bavovna / gh-issues-import.py
Created June 14, 2011 22:59
GitHub repository issues import
import urllib2
import json
from StringIO import StringIO
import base64
#==== configurations =======
username = "[email protected]"
password = "naked_password"
src_repo = "octocat/Hello-World"
dst_repo = "helloworld-inc/Hello-World"