Skip to content

Instantly share code, notes, and snippets.

View andreibosco's full-sized avatar

Andrei Bosco B. Torres andreibosco

View GitHub Profile
@andreibosco
andreibosco / battery.sh
Created January 30, 2017 12:53
battery status for C.H.I.P.
#!/bin/sh
# This program gets the battery info from PMU
# Voltage and current charging/discharging
#
# Nota : temperature can be more than real because of self heating
#######################################################################
# Copyright (c) 2014 by RzBo, Bellesserre, France
#
# Permission is granted to use the source code within this
# file in whole or in part for any use, personal or commercial,
@andreibosco
andreibosco / gist:7071673
Created October 20, 2013 16:13
cedilla (cedilha) no Ubuntu

Fonte

O cedilha não funciona ao utilizar o Gnome ou KDE no Ubuntu em inglês com um teclado americano.

Se a língua padrão do sistema for alterada para português do Brasil, o cedilha funcionará automaticamente. Para tal, vá ao menu System / Administration / Languages Support e mude o padrão para português.

Se você quer manter o inglês como língua padrão, siga os passos abaixo.

Selecione o layout de teclado chamado USA Alternative International (former us_intl) em System / Preferences / Keyboard / Layouts.
Edite o arquivo: libgtk2.0-0.immodules:
@andreibosco
andreibosco / docker-build.md
Created December 16, 2022 21:49
Build docker image for an specific platform

If you are using an M1 mac and want to build an x86 (64-bit) image:

DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build -t your_name/image_name .

@andreibosco
andreibosco / yubikey-server.md
Last active October 25, 2022 10:09
Configure linux ssh to use yubikey authentication
@andreibosco
andreibosco / better_bibtext_postscript.js
Last active September 24, 2022 00:40
Zotero Better Bibtex - Postscript to format access date (long format) and url fields on webpage items and setting month field as a number on any item.
if (Translator.BetterBibTeX) {
if (tex.has.month) {
tex.add({ name: 'month', value: tex.date.month});
}
if (zotero.itemType === 'webpage') {
if (zotero.accessDate) {
var customDate = new Date(zotero.accessDate.replace(/\s*T?\d+:\d+:\d+.*/, ''));
var intlCustomDate = new Intl.DateTimeFormat('en-GB', {year: 'numeric', month: 'long', day: 'numeric'}).format(customDate);
tex.add({ name: 'note', value: "(accessed on " + intlCustomDate + ")" });
}
@andreibosco
andreibosco / cpntools_macos.md
Last active August 21, 2022 22:34
running CPNtools 4.0.1 on MacOS

Running CPN Tools on MacOS Mojave

Based on the linux (Ubuntu) instructions by Sebastiaan J. (Bas) van Zelst available at https://www.win.tue.nl/~svzelst/misc/

  1. Download CPN Tools (for windows) from: http://cpntools.org/download
  2. Install wine: brew install wine
  3. Install CPN Tools using wine and make sure to include the MacOS simulator: wine cpntools_4.0.1.exe
  4. If this does not work due to a missing java version, download OpenJDK JRE installer from https://adoptopenjdk.net/
    • Remember that you have to download the Windows version and install it using wine
    • To install the .msi version, use wine start $installer, replacing $installer with the actual filename
  5. Download this bash script and place it in: ~/.wine/drive_c/Program Files (x86)/CPN Tools (or wherever you installed CPN Tools)
@andreibosco
andreibosco / unreal_derived_data_cache.md
Created February 8, 2021 16:22
Unreal derived data cache
@andreibosco
andreibosco / remove-alpha-channel.sh
Created June 22, 2022 14:44
Remove alpha channel from all PNG images in a directory
#!/bin/sh
# Source: https://stackoverflow.com/a/52962485/481690
for i in `ls *.png`; do convert $i -background black -alpha remove -alpha off $i; done
@andreibosco
andreibosco / java.library.path.md
Created October 17, 2015 17:49
How to add a .so to java.library.path
@andreibosco
andreibosco / FadeInOut.cs
Created February 5, 2022 15:59 — forked from NovaSurfer/FadeInOut.cs
Unity3D screen fading script (using new UI)
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
public class ScreenFader : MonoBehaviour
{
public Image FadeImg;
public float fadeSpeed = 1.5f;
public bool sceneStarting = true;