Skip to content

Instantly share code, notes, and snippets.

View hgouveia's full-sized avatar

Jose De Gouveia hgouveia

View GitHub Profile
@hgouveia
hgouveia / fix_normals.py
Created May 26, 2017 17:52
Blender script for fix normals on selected objects
# Usage:
# 1. Select the objects in blender
# 2. Open a Text Editor view in Blender.
# 3. Press Alt + O, or go to Text>Open Text Block and open the .py file
# 4. Then simply press Run script
import bpy
if bpy.context.selected_objects != []:
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
@hgouveia
hgouveia / remove_duplicates.py
Last active May 26, 2017 17:53
Blender script for remove duplicate vertices on selected objects
# Usage:
# 1. Select the objects in blender
# 2. Open a Text Editor view in Blender.
# 3. Press Alt + O, or go to Text>Open Text Block and open the .py file
# 4. Then simply press Run script
import bpy
if bpy.context.selected_objects != []:
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
@hgouveia
hgouveia / packtpub_redeem.sh
Created April 11, 2017 06:45
Script to redeem automatically books from `https://www.packtpub.com/packt/offers/free-learning` using bash and cronjob
#!/bin/bash
#==INSTRUCTIONS
# - Add EMAIL and PASS infomation
# - Replace script path with your path `/home/USER/scripts/` in the script
# - Check your machine timezone `date +"%Z %z"` output ex: UTC +0000
# - patckpub.com is UTC +0000, find the best hour for you to use in the crontab
# - Execute `crontab -e`
# - Add `0 1 * * * /bin/sh /home/USER/scripts/packtpub_redeem.sh > /home/USER/scripts/packtpub_redeem.out` , this mean everyday 1am
# - Restart Service `sudo service cron reload` (optional, crontab -e, will reload)
# - Add Permission `chmod 755 /home/USER/scripts/packtpub_redeem.sh`
// ==UserScript==
// @name GoogleMusicDark
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Google Music Dark Theme
// @author Jose De Gouveia
// @match https://play.google.com/music*
// @grant none
// ==/UserScript==
@hgouveia
hgouveia / tasks.json
Created February 4, 2018 08:11
Vscode task configuration for Godot 3.0 C#, for running and compiling
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "run",
"type": "shell",
"command": "D:/Godot/bin/Godot.exe --path \"${workspaceRoot}\""
},
@hgouveia
hgouveia / Vagrantfile
Created June 27, 2018 09:20
Vagrant: Ubuntu GUI Virtualbox
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", 1024, "--cpus", 1, "--vram", 256, "--accelerate3d", "on"]
vb.customize ["setextradata", :id, "GUI/MaxGuestResolution", "any" ]
vb.customize ["setextradata", :id, "CustomVideoMode1", "1024x768x32" ]
vb.customize ["setextradata", :id, "GUI/CustomVideoMode1", "1024x768x32" ]
vb.gui = true
end
config.vm.provision "shell", inline: <<-SHELL
@hgouveia
hgouveia / Vagrantfile
Created July 20, 2018 09:40
Gitlab vagrantfile with docker
Vagrant.configure("2") do |config|
config.vm.box = "minimal/xenial64"
config.vm.hostname = "gitlab.local"
config.vm.network :private_network, ip: "192.168.10.20"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 443, host: 8443
config.vm.network :forwarded_port, guest: 2222, host: 2222
config.vm.provision :docker
config.vm.provision "shell", inline: <<-SHELL
apt-get update
@hgouveia
hgouveia / JWTHelper.js
Last active July 25, 2018 09:04
Very simple helper class to decode JWT token on javscript
"use strict";
export class JWTHelper {
/**
* Decode a JWT token
*
* @static
* @param {string} token
* @throws Error
* @returns object|boolean
@hgouveia
hgouveia / JWT.server.js
Last active July 25, 2018 09:04
JWT nodejs very simple impl
/**
* Usage:
* const JWT = require('./JWT');
* const payload = {
* 'sub': 1234, // userid
* 'iat': Date().now(), // issued at
* 'exp': Math.floor(Date.now() / 1000) + 86400 // expiration time (1day = 86400)
* };
* const token = JWT.encode(payload, 'my_secret');
* console.log(token);
@hgouveia
hgouveia / profiles.json
Created December 20, 2019 09:05
Cmdr in the new Windows Terminal
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{577c6bb9-9c1a-42b3-93ff-613621d0072a}",
"profiles":
[
{
"guid": "{577c6bb9-9c1a-42b3-93ff-613621d0072a}",
"name": "cmder",
"icon": "G:\\data\\Programs\\cmder\\icons\\cmder.ico",
"commandline": "cmd.exe /K \"G:\\data\\Programs\\cmder\\vendor\\init.bat\" -new_console:d:%USERPROFILE%",