Skip to content

Instantly share code, notes, and snippets.

View timkrins's full-sized avatar
🇺🇦

Tim Krins timkrins

🇺🇦
View GitHub Profile
#!/usr/bin/env python3
"""
A quick script to filter a HAR file that was saved by Chrome, based on the request URL.
Useful for filtering HAR files to be converted by `har-to-k6` for load testing.
------------------------------------------------------------------------------
MIT License
Copyright (c) 2022 Tim Krins
Permission is hereby granted, free of charge, to any person obtaining a copy
@timkrins
timkrins / generate_replibyte_transformers.py
Last active July 27, 2022 10:42
A Replibyte config yaml generator
#!/usr/bin/env python3
"""
This is a quick script to generate a Replibyte configuration containing every
table and column in a MySQL db with a default transformer (ie 'transient').
You can supply a list of defaults for certain column names.
Requirements:
pip3 install mysql-connector-python
{
"title": "UK Logitech G213 keyboard",
"rules": [
{
"description": "G213 Backtick",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "grave_accent_and_tilde"
@timkrins
timkrins / github_keys.sh
Last active March 12, 2020 10:25
Github authorized_keys auto-insert
awk '
BEGIN {p=1}
/^#github-start/ {print;system("curl https://github.com/timkrins.keys");p=0}
/^#github-end/ {p=1}
p' authorized_keys > gh_authorized_keys
cat gh_authorized_keys > authorized_keys
# chmod +x ~/.ssh/github_keys.sh
# crontab -l > .cron
# echo '*/10 * * * * ~/.ssh/github_keys.sh' > .crontab

Keybase proof

I hereby claim:

  • I am timkrins on github.
  • I am timkrins (https://keybase.io/timkrins) on keybase.
  • I have a public key ASAXymmk_41AiHKqsNNUGMBs4R3gY2yddJmMQNOBwabiIgo

To claim this, I am signing this object:

@timkrins
timkrins / install.sh
Created March 15, 2019 09:38
xrdp 0.9.9 on ubuntu 16.04
sudo apt-get install git autoconf libtool pkg-config gcc g++ make libssl-dev libpam0g-dev libjpeg-dev libx11-dev libxfixes-dev libxrandr-dev flex bison libxml2-dev intltool xsltproc xutils-dev python-libxml2 g++ xutils libfuse-dev libmp3lame-dev nasm libpixman-1-dev xserver-xorg-dev
wget https://github.com/neutrinolabs/xrdp/releases/download/v0.9.9/xrdp-0.9.9.tar.gz
wget https://github.com/neutrinolabs/xorgxrdp/releases/download/v0.2.9/xorgxrdp-0.2.9.tar.gz
tar xvfz xrdp-0.9.9.tar.gz
tar xvfz xorgxrdp-0.2.9.tar.gz
cd xrdp-0.9.9/
./bootstrap
@timkrins
timkrins / drails.sh
Last active March 3, 2019 10:55
docker-compose + Rails commands
drails() {
docker-compose run web rails $*
sudo chown -R $USER:$USER .
}
drake() {
docker-compose run web rake $*
sudo chown -R $USER:$USER .
}
@timkrins
timkrins / copy-default-generators.sh
Last active March 3, 2019 10:16
Extending Rails Generators
# copy jbuilder controllers
mkdir -p lib/templates/rails/scaffold_controller && \
cp $(bundle show jbuilder)/lib/generators/rails/templates/* \
lib/templates/rails/scaffold_controller
# copy slim files
mkdir -p lib/templates/slim/scaffold && \
cp $(bundle show slim-rails)/lib/generators/slim/scaffold/templates/* \
lib/templates/slim/scaffold
@timkrins
timkrins / form_helper.rb
Last active December 17, 2018 11:23
ActionView FormBuilder Helper for React Fields
# config/initializers/form_helper.rb
#
# These helpers can be used inside a Rails form builder.
# Pass an 'fields' array as a component prop, with each element of the array being the result of the helper.
# The 'blank' helper should be used where the field value should not be returned.
# ie.
#
# props: { fields: [
# f.react_field :first_name,
# f.react_field :email,
@timkrins
timkrins / azureStackMeters.json
Created November 26, 2018 09:50
Azure Stack Meters JSON
[
{
"id":"f271a8a3-88c4-4d93-956a-063e1d2fa80b",
"name":"Static IP Address Usage",
"unit":"ip",
"time_scale":"hours",
"notes":"Count of IP addresses used. If you call the usage API with a daily granularity, the meter returns IP address multiplied by the number of hours."
},
{
"id":"9e2739ba-8674-4796-b465-f64674b822ba",