Skip to content

Instantly share code, notes, and snippets.

View rdlu's full-sized avatar
🎯
Focusing

Rodrigo Dlugokenski rdlu

🎯
Focusing
View GitHub Profile
@rdlu
rdlu / pre-commit
Created December 10, 2024 12:30
Simple Elixir/Phoenix pre-commit hook
#!/bin/sh
# Get staged Elixir files
STAGED_FILES=$(git diff --cached --name-only -- '*.ex' '*.exs' '*.heex' '*.eex')
if [ -z "$STAGED_FILES" ]; then
echo "No Elixir files to check."
exit 0
fi
@rdlu
rdlu / ask-mfa
Created June 4, 2019 17:04
Connecting to Amazon SSM using MFA
#! /bin/bash
ACCOUNT_NUM=<MY_AWS_ACCOUNT_NUM>
ACCOUNT_USER=<MY_AWS_ACCOUNT_USER>
aws configure --profile ask-mfa list > /dev/null
if [ $? -eq 0 ]
then
read -p "Token MFA da conta $ACCOUNT_NUM/$ACCOUNT_USER: " TOKEN
aws sts get-session-token --serial-number arn:aws:iam::$ACCOUNT_NUM:mfa/$ACCOUNT_USER --profile ask-mfa --token-code $TOKEN > ~/.aws/temp_creds.json
aws configure --profile default set aws_access_key_id $(jq -r ".Credentials.AccessKeyId" ~/.aws/temp_creds.json)
@rdlu
rdlu / dosboxm.sh
Last active March 16, 2017 13:32
Running Timidity + Munt + Dosbox
#!/bin/bash
timidity -iA &
mt32emu-qt &
sleep 1s
timidity_port=$(aconnect -ol | grep TiMidity | head -1 | awk '{print $2}')0
munt_port=$(aconnect -ol | grep Munt | head -1 | awk '{print $2}')0
dosbox -c "set timidity=$timidity_port" -c "set munt=$munt_port"
kill %1 %2
@rdlu
rdlu / es_input.cfg
Last active February 18, 2017 22:24
For my PS3 and ipega pg9021
<?xml version="1.0"?>
<inputList>
<inputConfig type="keyboard" deviceName="Keyboard" deviceGUID="-1">
<input name="a" type="key" id="120" value="1" />
<input name="b" type="key" id="122" value="1" />
<input name="down" type="key" id="1073741905" value="1" />
<input name="left" type="key" id="1073741904" value="1" />
<input name="leftanalogdown" type="key" id="1073741917" value="1" />
<input name="leftanalogleft" type="key" id="1073741916" value="1" />
<input name="leftanalogright" type="key" id="1073741918" value="1" />
@rdlu
rdlu / ipega classic gamepad.cfg
Last active September 23, 2017 13:51
Ipega PG-9021 on Linux (Archlinux) working on Retroarch (Put this on ~/.config/retroarch/autoconfig/udev)
# -------------------------------------------------------------------------------------------------------------------------------------------------
# If RetroArch do NOT detect the controller when connected via Bluetooth and won't even recognize manual binding,
# fix it by adding this udev rule (the line below WITHOUT the # symbol at the beginning!) to "/etc/udev/rules.d/10-local.rules" and reboot.
# SUBSYSTEM=="input", ATTRS{name}=="ipega classic gamepad", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
# -------------------------------------------------------------------------------------------------------------------------------------------------
input_driver = "udev"
input_device = "ipega classic gamepad"
input_vendor_id = "32903"
input_product_id = "2012"
@rdlu
rdlu / es_input.cfg
Created February 5, 2017 01:54
emulation station with PS3 controller + keyboard
<?xml version="1.0"?>
<inputList>
<inputConfig type="keyboard" deviceName="Keyboard" deviceGUID="-1">
<input name="a" type="key" id="120" value="1" />
<input name="b" type="key" id="122" value="1" />
<input name="down" type="key" id="1073741905" value="1" />
<input name="left" type="key" id="1073741904" value="1" />
<input name="leftanalogdown" type="key" id="1073741917" value="1" />
<input name="leftanalogleft" type="key" id="1073741916" value="1" />
<input name="leftanalogright" type="key" id="1073741918" value="1" />

Keybase proof

I hereby claim:

  • I am rdlu on github.
  • I am rdlu (https://keybase.io/rdlu) on keybase.
  • I have a public key whose fingerprint is 3652 6C47 37D8 4155 3B7F 4F9A E96B 451F 2737 BAC3

To claim this, I am signing this object:

#!/bin/bash
# install elasticsearch VERSION on Ubuntu 12.04 (precise)
VERSION=0.19.8
curl -OL -k http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-$VERSION.zip
unzip elasticsearch-$VERSION.zip
sudo mv elasticsearch-$VERSION /usr/local/
@rdlu
rdlu / es.sh
Created February 19, 2013 17:35
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://github.com/elasticsearch/elasticsearch/archive/v0.20.1.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share