Skip to content

Instantly share code, notes, and snippets.

View lucaspar's full-sized avatar

Lucas Parzianello lucaspar

  • University of Notre Dame
View GitHub Profile
@lucaspar
lucaspar / landisc.py
Last active October 4, 2019 20:54
[ SCR ] LAN IPs discovery with python using nmap :trollface:
#!/usr/bin/python3
# List all hosts' IP adresses in the
# local network reachable by nmap -sn
import os
import re
import sys
if __name__ == "__main__":
@lucaspar
lucaspar / ackermann.cpp
Last active October 4, 2019 20:54
[ SCR ] Ackermann sample with memoization technique
#include <iostream>
#include <cstdlib>
#include <cstring>
#define MAX_M 10
#define MAX_N 1000000
#define VERBOSE false
// ------------------------------------------------------------
// Ackermann sample with memoization technique for optimization
@lucaspar
lucaspar / git_fixes.sh
Last active October 4, 2019 20:54
[ FIX ] Useful git hotfixes 🔫 :feelsgood:
# remove files added later in .gitignore
git rm -r --cached .
git add .
git commit -m 'cleared git cache'
git push origin master
# -------------- CUT HERE --------------
# Fix detached head (and keep changes)
@lucaspar
lucaspar / git_monitor.sh
Last active October 4, 2019 20:52
[ SCR ] Identifies uncommitted changes in git projects
#!/bin/bash
# Detects all git directories and run their status to identify uncommited changes
declare -a dirs=("projects" "work")
# runs git status in directory in argument
gitstatus () {
echo -e "\e[1;35m>>> GIT MONITOR :: " $1 "\e[0m\n"
cd $1
cd ..
@lucaspar
lucaspar / gpg_backup.md
Last active October 4, 2019 20:26
[ BKP ] Backing up GPG keys

Backing up GPG keys 🔐

Based on here

Export:

gpg --armor --export > pub.asc
gpg --armor --export-secret-keys > priv.asc
gpg --armor --export-ownertrust &gt; trust.asc
@lucaspar
lucaspar / phone_as_audio_source.sh
Last active August 10, 2022 23:02
[ FIX ] Sets phone as audio source for laptop speakers through bluetooth 🔉
#######################################################################
## Sets phone as audio source for laptop speakers through bluetooth ##
#######################################################################
# check bluetooth
rfkill list
# if bluetooth blocked, run
rfkill unblock bluetooth
@lucaspar
lucaspar / xorg.conf
Last active October 4, 2019 20:33
[ FIX ] Blank screen fix after Nvidia update.
# ::: NVIDIA INSTALL :::
#
# Nvidia driver installation: https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-18-04-bionic-beaver-linux.
# Method of "Manual Install using the Official Nvidia.com driver".
#
# ::: DISPLAY FIX :::
#
# 0. append the following to /usr/share/sddm/scripts/Xsetup:
# ---------
# xrandr --setprovideroutputsource modesetting NVIDIA-0
@lucaspar
lucaspar / IRRF-imposto.js
Last active January 22, 2024 16:04
Cálculo de IR em JavaScript com teste unitário.
/* Fonte: https://gist.github.com/lucaspar/2c20754b37920217678cebb64170cb7a */
/**
* Calcula o imposto de renda sobre o valor de rendimentos tributáveis,
* conforme tabela progressiva do ano tributário de 2023, seguindo a
* incidência mensal do imposto sobre a renda de pessoas físicas (IRPF).
*
* @params {Number} rendimentos Renda a ser tributada, em R$.
* @returns {Number} imposto a pagar sobre `rendimentos`, em R$.
**/
@lucaspar
lucaspar / corr_conv.py
Last active October 4, 2019 20:33
[ SCR ] Correlation and Convolution Script
#!/usr/bin/env python
# Implementation of correlation and convolution kernels with no dependencies (e.g. numpy)
# Translated from the mathematical expressions with a focus on readability (not very "pythonic")
# ----------
# print image matrix
def printimg(img, title=''):
@lucaspar
lucaspar / userChrome.css
Last active March 8, 2024 00:09
Stylesheets for collapsible vertical tabs for Firefox. Tabs expand horizontally when hovered, similar to Edge's.
/*
How to use this CSS:
0. Install the Sidebery extension: https://addons.mozilla.org/en-US/firefox/addon/sidebery/.
1. In Sidebery settings:
a. Set the title preface must as "[S] " (without quotes).
This is used by CSS rules below to identify when Sidebery is active.
b. Set 'Tabs tree structure' to false -- this stylesheet doesn't adapt to
multiple tab levels, but feel free to tweak it!
c. Copy and paste the "SIDEBERY STYLES" section below in