Skip to content

Instantly share code, notes, and snippets.

@baztian
baztian / emacs-run.bat
Last active May 13, 2020 00:44 — forked from Shade30/emacs-run.bat
Cygwin emacs-w32 wrapper. Allows to run emacs with arguments directly from windows.
@echo off
Setlocal EnableDelayedExpansion
set CYGDIR=C:\cygwin64
set CYGBINDIR=%CYGDIR%\bin
set PATH=%PATH%;%CYGBINDIR%;%CYGDIR%\usr\local\bin;%CYGDIR%\usr\bin
cd /d %CYGDIR%\home\%USERNAME%
if [%1]==[] goto BLANK
#!/usr/bin/env python
"""Formats a CSV string from windows clipboard to JIRA Table markup
(https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=tables)
on windows clipboard.
"""
import csv
def convert(csvfile, delimiter=',', quotechar='"'):
r"""
@baztian
baztian / README.md
Last active August 18, 2018 11:59
Install Open Liberty to a directory with a more meaningful name
@baztian
baztian / accels.scm
Last active July 26, 2023 15:45
xfce-terminal settings
; xfce4-terminal GtkAccelMap rc-file -*- scheme -*-
; this file is an automated accelerator map dump
;
(gtk_accel_path "<Actions>/terminal-window/goto-tab-1" "<Alt>1")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-3" "<Alt>3")
; (gtk_accel_path "<Actions>/terminal-window/file-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/close-other-tabs" "")
; (gtk_accel_path "<Actions>/terminal-window/search" "<Primary><Shift>f")
; (gtk_accel_path "<Actions>/terminal-window/next-tab" "<Primary>Page_Down")
; (gtk_accel_path "<Actions>/terminal-window/copy-html" "")
# lircrc file for squeezelite
begin
button = KEY_PLAYPAUSE
repeat = 0
prog = squeezelite
config = pause
end
@baztian
baztian / sqs-copy.sh
Created May 12, 2021 14:08
Create a shell template to copy from one AWS SQS queue to another
#!/usr/bin/env bash
choose_queue()
{
title=$1
queues=$(aws sqs list-queues --query 'QueueUrls' --output text|tr '\t' '\n')
i=1
items=""
items=$(echo -e "$queues"|sed -e 's#.*/##g' | while read p; do echo "$i $p" && i=$((i+1));done)
TMPFILE=$(mktemp)
#!/bin/sh
# Source: https://stackoverflow.com/a/28776166/1960601
sourced=0
if [ -n "$ZSH_VERSION" ]; then
case $ZSH_EVAL_CONTEXT in *:file) sourced=1;; esac
elif [ -n "$KSH_VERSION" ]; then
[ "$(cd -- "$(dirname -- "$0")" && pwd -P)/$(basename -- "$0")" != "$(cd -- "$(dirname -- "${.sh.file}")" && pwd -P)/$(basename -- "${.sh.file}")" ] && sourced=1
elif [ -n "$BASH_VERSION" ]; then
(return 0 2>/dev/null) && sourced=1
@baztian
baztian / ansible-play-role-local
Last active December 1, 2021 14:28
Execute ansible role
#!/bin/sh
set -e
if [ $# -lt 1 ]; then
echo "Executes a ansible role on localhost" > /dev/stderr
echo "Usage $(basename $0) ROLENAME [additional ansible-playbook options]" > /dev/stderr
echo "Example: $(basename $0) baztian.keepass -K -b" > /dev/stderr
exit 1
fi
@baztian
baztian / get_repos.sh
Last active February 2, 2022 21:09 — forked from xalvarez/get_repos.sh
Clone and fork a team's first 100 GitHub repos. Then, add remotes for all potential forks.
#!/usr/bin/env bash
# Clone and fork a team's first 100 GitHub repos. Then, add remotes for all potential forks.
#
# Requires:
# - git: https://git-scm.com/downloads
# - github-cli: https://github.com/cli/cli
# - jq: https://stedolan.github.io/jq/download/
#
# The first time you run this script or use gh for the first time in your system
@baztian
baztian / merge-prs.sh
Last active January 12, 2023 16:49
Command line tool to handle merging of GitHub pull requests
#!/bin/bash
write_main_undo() {
echo git checkout $main_branch >> "$UNDO_FILE"
echo git reset --hard "${main_remote%%/*}" >> "$UNDO_FILE"
echo "Undo instructions written to $UNDO_FILE"
}
if [ -z "$1" ]
then