Skip to content

Instantly share code, notes, and snippets.

View LeZuse's full-sized avatar
🚀
Scaling productboard.com

Tomas Ruzicka LeZuse

🚀
Scaling productboard.com
View GitHub Profile
@LeZuse
LeZuse / parse.js
Created November 8, 2019 16:24
Parse out details of enqueued jobs from recovered ElastiCache backup
#!/usr/bin/env node
const fs = require('fs')
const FILE = './bulk.csv';
const data = fs.readFileSync(FILE, 'utf8');
console.log('bytes', data.length)
const lines = data.split('\n');
console.log('lines', lines.length);
@LeZuse
LeZuse / zoom.5m.sh
Created November 4, 2019 12:22
BitBar plugin for listing today's meetings with a Zoom quick join option
#!/usr/local/bin/bash
# Prerequisites:
# mkdir gcalcli-local && cd !$
# pip3 install virtualenv
# virtualenv venv
# source venv/bin/activate
# pip3 install gcalcli
# which gcalcli # use this as command path in this script below
# deactivate
@LeZuse
LeZuse / prss.sh
Last active October 11, 2019 16:33
GitHub PR view & checkout
# prerequisites: brew install fzf hub
function prss() {
hub issue --include-pulls --color \
--since=`date -u -v-1m +"%Y-%m-%dT%H:%M:%SZ"` \
--format="%Cyellow%i%Creset %t %Cwhite@%au%Creset %l %Cyellow%cr%Creset%n" | \
fzf --ansi --preview="echo {} | cut -d' ' -f1 | tr -d '#' | xargs -I % hub issue show %" | \
cut -d' ' -f1 | tr -d '#' | \
xargs -I {} sh -c 'git rev-parse --verify pr-{} || git fetch origin pull/{}/head:pr-{} && git checkout pr-{}'
}
@LeZuse
LeZuse / zoom-mute.scpt
Created September 27, 2019 10:21
Zoom (un)mute
tell application "System Events" to tell process "zoom.us"
tell window 1
set buttonTitle to description of button 1
# needs "Window > Always show meetings controls" enabled
if buttonTitle = "Unmute My Audio" then
click button 1
"unmuted"
else if buttonTitle = "Mute My Audio" then
click button 1
"muted"
@LeZuse
LeZuse / elements.scpt
Last active August 19, 2019 17:44
Inspecting the UI elements in AppleScript
# Source: https://macscripter.net/viewtopic.php?pid=189593#p189593
# example: inspecting the contents of the Notes window
tell application "System Events" to tell process "Notes"
class of UI elements
tell window 1
class of UI elements
tell splitter group 1
class of UI elements
# get name of button 1
tell splitter group 1
@LeZuse
LeZuse / mrs.bash
Last active July 30, 2019 14:31
List My GitLab Merge Requests
function mrs() {
[ -z "$GITLAB_TOKEN" ] && \
echo 'Missing GITLAB_TOKEN env var. See https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token' && \
return 1
# download from GL API, process with jq and colorize with sed replace
curl https://gitlab.com/api/v4/merge_requests?private_token=$GITLAB_TOKEN\&state=opened\&sort=desc\&scope=assigned_to_me 2>/dev/null | \
jq --raw-output '.[] | "#" + (.iid | tostring) + " " + .title + " @" + .author.username + " | " + (.labels | join(", ")) + " \n 👉 " + .web_url + "\n"' | \
sed "s,.*https.*,$(tput setaf 6)&$(tput sgr0)," | \
sed -e "s/\(#[0-9]*\)\(.*\)\(@[a-zA-Z0-9-]*\) |\(.*\)/$(tput setaf 220)\1$(tput sgr0)\2$(tput setaf 7)\3 $(tput setab 4)\4$(tput sgr0)/g"
@LeZuse
LeZuse / helpers.sh
Created February 22, 2019 17:36
Heroku app helpers
function staging() {
echo -e "\e[2m\$ heroku $@ -a heroku-staging-app\e[0m"
heroku $@ -a heroku-staging-app
}
function prod() {
echo -e "\e[2m\$ heroku $@ -a heroku-production-app\e[0m"
heroku $@ -a heroku-production-app
}
alias prapps='heroku pipelines:info heroku-pipeline | grep review'
function prapp (){
@LeZuse
LeZuse / Default.bttpreset
Last active March 26, 2019 09:21
Better Touch Tool config
{
"BTTPresetName" : "Default",
"BTTPresetUUID" : "CB3027C7-7330-45F9-AFAC-448FAD8856AD",
"BTTPresetContent" : [
{
"BTTAppBundleIdentifier" : "com.apple.finder",
"BTTAppName" : "Finder",
"BTTTriggers" : [
]
@LeZuse
LeZuse / apps.md
Last active May 2, 2020 18:32
Mac apps
@LeZuse
LeZuse / stats_logger.rb
Last active June 21, 2021 13:53
Puma plugin for stats logging on Heroku
Puma::Plugin.create do
def production?
ENV.fetch('RACK_ENV', 'development') == 'production'
end
def log(msg)
if production?
Rails.logger.info msg
else
puts msg