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 / restore_boot_endeavouros_btrfs.md
Created July 15, 2023 17:10
restore boot - endeavourOS with BTRFS

To restore Linux item to EFI boot list

  • switch into root: sudo su

  • list disks and partitions: fdisk -l

  • find main list filesystem partition and efi partition

  • create mountpoint: mkdir /mnt/arch

  • mount partition (additional argument needed for btrfs): mount -t auto -o subvol=@ /dev/nvme0n1p6 /mnt/arch/ (source: https://forum.endeavouros.com/t/chroot-into-a-btrfs-uefi-system-from-live-media/15986/3)

  • change root into mounted partition: arch-chroot /mnt/arch

  • mount EFI partition: mount -t auto /dev/nvme0n1p2 /efi/

@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 / 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 / ssh-gpg-yubikey-macos.md
Created July 16, 2022 16:27
SSH keys on a Yubikey in a Mac

Based on https://davecoyle.com/tech-notes/ssh-keys-on-a-yubikey-mac/

SSH keys on a Yubikey in a Mac

Software Stuff

  • Install the YubiKey Manager CLI (ykman); alternative installation options can be found here: brew install ykman

  • Install GPG >= 2.1. Version 2.1 simplified the running of gpg-agent. The version isn’t a hard requirement, but it might make your life easier.

@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 / 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;
@andreibosco
andreibosco / tensorflow1.14-opencv-cuda-object_detection.md
Last active October 24, 2021 15:32
Setup environment with TF 1.14 + OpenCV + CUDA for Object Detection
@andreibosco
andreibosco / django-test-i18n-shell.md
Created July 31, 2021 22:30
Django - test i18n language using shell
  • Use the following commands, replacing your string here with the string that you want to test.
  • Obs.: shell_plus is provided by django-extensions
python manage.py shell_plus
from django.utils.translation import activate, get_language_info, ugettext as _
get_language_info('fr')
activate('fr')
print(_("your string here"))
@andreibosco
andreibosco / CUDA-compute-fix.patch
Last active July 30, 2021 16:24
Caffee CUDA compute fix
--- cmake/Cuda.cmake 2021-07-30 12:07:44.707798734 -0400
+++ cmake/Cuda.cmake.fixed 2021-07-30 12:22:30.551329548 -0400
@@ -4,7 +4,7 @@
# Known NVIDIA GPU achitectures Caffe can be compiled for.
# This list will be used for CUDA_ARCH_NAME = All option
-set(Caffe_known_gpu_archs "20 21(20) 30 35 50 60 61")
+set(Caffe_known_gpu_archs "30 35 50 60 61")
################################################################################################