Skip to content

Instantly share code, notes, and snippets.

View dbonates's full-sized avatar
🏠
Working from home

Daniel Bonates dbonates

🏠
Working from home
  • Self Industry
  • Florianopolis, Brazil
View GitHub Profile
# from /usr/sbin/
wget https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/retrogame
chmod 755 retrogame
# from /boot
# original retrogame.cfg with full example file at:
# https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/configs/retrogame.cfg.zero
#
wget wget https://gist.githubusercontent.com/dbonates/159a3d491a8d147facde651559b76620/raw/698f5e34a46d28fc018c96fd075318fc4f02745f/retrogame.cfg
@dbonates
dbonates / S32retrogame
Last active September 23, 2019 02:21
retrogame startup script
#!/bin/sh
PIDFILE=/var/run/retrogame.pid
NAME="S32retrogame"
RUN_AS=root
CMD=/usr/bin/retrogame
do_start() {
# "... Starting : retrogame gpio-remapper"
start-stop-daemon --start --background --user $RUN_AS --pidfile $PIDFILE --make-pidfile --chuid $RUN_AS --startas $CMD
}
do_stop() {
@dbonates
dbonates / retrogame.cfg
Last active September 26, 2019 14:53
retrogame config file
LEFT 17 # Joypad left
RIGHT 5 # Joypad right
DOWN 27 # Joypad down
UP 23 # Joypad up
Z 4 # 'A' button
X 20 # 'B' butto
ESC 6 # Exit ROM; PiTFT Button 1
LEFTCTRL 26 # 'Select' button; PiTFT Button 2
@dbonates
dbonates / volumetria.sql
Created July 30, 2019 14:21
Volumetria em todos os schema/bancos de dados e tabelas postgresql
SELECT datname, pg_size_pretty(pg_database_size(datname))
FROM pg_database;
--Tamanho de todas as tabelas.
SELECT relname as "Table",
pg_size_pretty(pg_total_relation_size(relid)) As "Size",
pg_size_pretty(pg_total_relation_size(relid) -
pg_relation_size(relid)) as "External Size"
FROM pg_catalog.pg_stat_all_tables ORDER BY
pg_total_relation_size(relid) DESC;
{
"Code": 1,
"Message": "Success",
"Result": {
"PurchaseListTotalSize": 156,
"PurchaseList": [
{
"PurchaseID": 69154851,
"ExpirationDate": "\/Date(1564542000000)\/",
"PurchaseStatus": "Canceled",
@dbonates
dbonates / install-tmux-binary.sh
Last active June 1, 2019 20:58
easy install tmux without need to build
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update -yqqu
sudo apt-get install tmux-next
sudo rm /usr/bin/tmux
sudo ln -s /usr/bin/tmux-next /usr/bin/tmux
@dbonates
dbonates / tmux-color-list.sh
Created June 1, 2019 20:44
list tmux available colors
for i in {0..255}; do printf "\x1b[38;5;${i}mcolour%-5i\x1b[0m" $i ; if ! (( ($i + 1 ) % 8 )); then echo ; fi ; done
# ex: choose your color than execute:
# set -g status-fg colour28
@dbonates
dbonates / replace_string_cmd.sh
Last active May 31, 2019 02:08
replace string on files using ack
# this command will search and replace all occurrences of string1 to string2
ack -l string1 | xargs perl -pi -E 's/string1/string2/g'
# as function to make life easier
#
# usage: replace oldString newString
#
func replace() {
ack -l "$1" | xargs perl -pi -E "s/${1}/${2}/g"
}
@dbonates
dbonates / 24-bit-color.sh
Created May 30, 2019 02:31
print pattern for testing color support on terminal
#!/bin/bash
# This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
@dbonates
dbonates / tmux-build.sh
Created May 30, 2019 02:15
build and install tmux
#!/usr/bin/env bash
sudo apt update
#sudo apt install -y git
sudo apt install -y automake
sudo apt install -y build-essential
sudo apt install -y pkg-config
sudo apt install -y libevent-dev
sudo apt install -y libncurses5-dev
rm -fr /tmp/tmux
git clone https://github.com/tmux/tmux.git /tmp/tmux