Skip to content

Instantly share code, notes, and snippets.

View henriquegogo's full-sized avatar

Henrique Gogó henriquegogo

View GitHub Profile
@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;
@henriquegogo
henriquegogo / nvlc
Created August 22, 2019 18:01
VLC ncurses without video and sith some keyboard shortcuts
/usr/bin/nvlc --no-video --global-key-faster Ctrl+] --global-key-slower Ctrl+[ --global-key-play-pause Ctrl+p $1
@henriquegogo
henriquegogo / pyweb.py
Created August 19, 2019 05:13
Mini python browser using Gnome Instrospection
#!/usr/bin/python
from gi import require_version
require_version('Gtk', '3.0')
require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2, Gdk
Gtk.init()
win = Gtk.Window()
@henriquegogo
henriquegogo / .newsboat-config
Created May 16, 2019 23:51
Newsboat config file
browser w3m
# Newsboat colour scheme to work with the Nord palette
# from Arctic Studios - https://github.com/arcticicestudio/nord
# Tested with the iTerm2 Nord terminal colour scheme
# https://github.com/arcticicestudio/nord-iterm2
# though should work with any terminal using the palette
color background color236 default
color listnormal color248 default