Skip to content

Instantly share code, notes, and snippets.

View henriquegogo's full-sized avatar

Henrique Soares henriquegogo

View GitHub Profile
@henriquegogo
henriquegogo / love.lua
Last active April 10, 2022 08:24
Lua LÖVE file reference for autocomplete
-- takes all
love = {
audio = {
getActiveEffects = function(...) end, --Gets a list of the names of the currently enabled effects.
getActiveSourceCount = function(...) end, --Gets the current number of simultaneously playing sources.
getDistanceModel = function(...) end, --Returns the distance attenuation model.
getDopplerScale = function(...) end, --Gets the global scale factor for doppler effects.
getEffect = function(...) end, --Gets the settings associated with an effect.
getMaxSceneEffects = function(...) end, --Gets the maximum number of active effects.
getMaxSourceEffects = function(...) end, --Gets the maximum number of active Effects for each Source.
@henriquegogo
henriquegogo / .xinitrc.keycode
Created March 19, 2022 04:46
Remap key in linux
xmodmap -e "keycode 49 = apostrophe quotedbl bar bar bar"
@henriquegogo
henriquegogo / .bashrc-fluidsynth
Last active February 15, 2022 14:23
Autoload fluidsynth. Copy to .bashrc
#!/bin/bash
# Add these lines in .bashrc and set Raspberry Pi to auto login
if [ ! -f /tmp/fluidsynth-bootloaded ]; then
touch /tmp/fluidsynth-bootloaded
killall fluidsynth
fluidsynth -a alsa -g 1 /usr/share/sounds/sf2/default-GM.sf2 -o midi.autoconnect=1 -c 4
fi
@henriquegogo
henriquegogo / sac.hp12c
Last active October 11, 2021 01:28
HP Calculators Programs - SAC for 12c | TVM for 42s
// Constant Amortization System for HP12C (Platinum)
// Author: Henrique Gogó ([email protected])
//
// Instructions: enter n, i and PV values and set FV as 0.
// Set register 9 if you want to get an specific payment number.
//
// After program ends, the result saved in registers will be:
// X: current payment value
// FV: remaining amount to pay
// PMT: amortization value (fixed)
@henriquegogo
henriquegogo / qemu-create.sh
Last active June 28, 2020 04:00
Scripts to create and run qemu VMs
qemu-img create -f qcow2 "$@" 80G
@henriquegogo
henriquegogo / speechListenSpeak.js
Created June 25, 2020 15:50
Speech recognition and speak using native browser API
let recognition = new webkitSpeechRecognition();
recognition.lang = 'pt-BR';
recognition.onresult = ({ results }) => {
const transcript = results[0][0].transcript;
speechSynthesis.speak(new SpeechSynthesisUtterance(transcript));
}
recognition.start();
@henriquegogo
henriquegogo / .eslintrc.json
Last active April 16, 2020 14:40
Eslint config for all projects
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
@henriquegogo
henriquegogo / type.js
Last active October 23, 2019 19:47
Javascript Type Check
function type() {
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] !== arguments[++i].constructor) throw new Error('Type Error');
}
return arguments[1];
}
/*
type(
String, this.name = "Henrique",
@henriquegogo
henriquegogo / dockerApp.sh
Created October 14, 2019 21:07
Docker app
# Create a docker image with env var DISPLAY=:0
# Save this image with docker save > firefox.tar
# Create this shell script in the same folder of firefox.tar
BASEDIR=$(dirname $(readlink -f "$0"))
docker load < $BASEDIR/firefox.tar
docker run --rm --net host -v $BASEDIR:/home/user firefox
@henriquegogo
henriquegogo / cool.h
Last active October 11, 2019 03:49
C Object Orientation Library
#ifndef COOL_H
#define COOL_H
#include <stdlib.h>
typedef struct object {
char *value;
void (*set)();
char* (*get)();
} object;