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
# disconect the device
# run this command (provide a password it it asks for)
sudo killall -STOP -c usbd
# reconnect the device and it should work
var executing: Bool { get } // true if the receiver is executing, otherwise false.
var finished: Bool { get } //true if the receiver has finished execution, otherwise false.
var cancelled: Bool { get } //true if the receiver has been cancelled, otherwise false.
var objDS= DeviceStatus()
let thread: NSThread = NSThread(target: objDS, selector: "checkDeviceStatus", object: nil)
if thread.executing{
println("executing")
@dbonates
dbonates / autostart.sh
Last active April 8, 2022 22:00
Script to add safe shutdown and fan control to a raspberry pi. I'm using it on a batocera box I'm building.
# edit /opt/retropie/configs/all/autostart.sh
# to call our script before emulation start
if test -e "/home/pi/userdata/retropie-custom.sh"; then
bash /home/pi/userdata/custom.sh $1 &
fi
emulationstation #auto
[
{
"id": "0f37d5a80f6794f64d753ea1cefa6d26",
"_insertTimestamp": "2020-01-08 23:00:09.001 UTC",
"retailer": "Amazon-UK",
"productNo": "B07NW1JCK3",
"username": "Tomás Montenegro, Belo Horizonte - MG",
"rating": 5.0,
"subject": "Fantástico!!!",
"content": "Tortas deliciosas. Os waffles também estavam muito bons. Equipe muito atenciosa. :)",
import AppKit
let currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
let imageURL = URL(fileURLWithPath: "logo.png", relativeTo: currentDirectoryURL)
let args = ProcessInfo.processInfo.arguments
let appVersion = args[1]
func write(_ text: String, on image :NSImage) -> NSImage
ffmpeg -i logo.png -vf drawtext="fontfile=SourceCodePro-Bold.ttf: \
text='Letro rules': fontcolor=black: fontsize=24: box=1: boxcolor=yellow@1.0: \
boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2/2/2" -codec:a copy logo-txt.png
@dbonates
dbonates / ffmpeg-bash-handy-functions.sh
Created November 13, 2019 05:40
Some handy ffmpeg functions I use everyday.
#
# VIDEO / IMAGE RELATED
#
# requires: ffmpeg
# tip: put this funcion on your ~/.profile file
#
# Compress video files while keep their quality
@dbonates
dbonates / tmux-with-true-color.sh
Created October 28, 2019 23:21
changes on tmux and vim configs to support true color
# file: .tmux.conf
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
# file: .vimrc
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
@dbonates
dbonates / pico8-vibration-motor-and-led-using-gpio.lua
Created October 23, 2019 11:47
small snippet experimenting vibration motor and led on pico-8 games
function write_gpio_unsigned(num,pin_index,bits)
local lastbit_i =
0x5f80+pin_index+bits-1
local mask = 1
for j=0,bits-1 do
local bit = shr(band(num, mask), j)
poke(lastbit_i-j, bit*255)
mask = shl(mask, 1)
end
@dbonates
dbonates / letro.json
Last active October 10, 2019 16:02
gist gift for letro
{
"code": 200,
"deals":[
{
"cashback":{
"horarios":[
{
"start":"06:00",
"end":"07:00"
},