Skip to content

Instantly share code, notes, and snippets.

View henriquegogo's full-sized avatar

Henrique Gogó henriquegogo

View GitHub Profile
@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
@henriquegogo
henriquegogo / .profile
Created May 7, 2019 02:42
Run startx after login
# ...
# Run startx on boot
if [[ ! $DISPLAY && XDG_VTNR -eq 1 ]]; then
exec startx
fi
@henriquegogo
henriquegogo / jsc-env.js
Created March 8, 2019 04:24
Run jsc (JavaScriptCore) with CommonJS require and console.log functions. Usage: $ jsc jsc-env.js YOURSCRIPT.js
console = { log: print };
exports = {};
require = function() { load(...arguments); return exports };
@henriquegogo
henriquegogo / receita.json
Created March 1, 2019 20:34
Exemplo para requisições
{
"titulo": "Receita de bolo da vovó",
"ingredientes": [
"Farinha", "Ovo", "Açúcar", "Pipoca"
]
}
@henriquegogo
henriquegogo / makeRequest.go
Last active January 9, 2019 19:48
Make request and parse json into Go struct collection, map to another struct collection and print
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type gist struct {
ID string `json:"id"`