Skip to content

Instantly share code, notes, and snippets.

View fmartins-andre's full-sized avatar

André Martins fmartins-andre

View GitHub Profile
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@kelvinst
kelvinst / local-gitignore.md
Last active April 9, 2025 02:03
Como fazer um .gitignore local?

Como fazer um .gitignore local?

Bom, este é um recurso, como muitos outros, bem escondido do git. Então resolvi fazer um post para explicar a situação em que pode-se usar e como fazer essa magia negra. 👻

O problema

Você provavelmente já adicionou algum dia um arquivo no projeto que não deveria ser commitado certo? E como você fez para ignorar esse arquivo mesmo? Provavelmente adicionou no arquivo .gitignore.

OK então, aí você commitou esse arquivo .gitignore e pronto, mais ninguém poderá criar um arquivo com o mesmo nome e commitar. Mas espera aí! Não era isso que você queria! Você só queria ignorar esse arquivo na sua máquina, se alguém, algum dia por obséquio achar esse um nome bom para seu arquivo, que assim seja.

@jesstelford
jesstelford / event-loop.md
Last active June 2, 2025 05:57
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@cassidoo
cassidoo / useMedia.jsx
Last active October 27, 2022 16:13
An example of checking on a media query with React Hooks
function useMedia(query) {
const [matches, setMatches] = useState(window.matchMedia(query).matches)
useEffect(() => {
const media = window.matchMedia(query)
if (media.matches !== matches) {
setMatches(media.matches)
}
const listener = () => {
setMatches(media.matches)
@fmartins-andre
fmartins-andre / run_elevated.ps1
Created March 15, 2021 17:54
A Powershell script to run executables in elevated mode
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true, Position = 0)][string]$exeFileName,
[Parameter(Mandatory = $true, Position = 1)][string]$credentialName
)
$wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop
function CheckIfFileExists {
@fmartins-andre
fmartins-andre / import-openvpn-networkmanager.md
Created December 13, 2021 11:53
Import an openvpn file to Gnome NetworkManager

Import OpenVPN file to NetworkManager

tags: linux, gnome, networkManager, pkcs12, p12

reference: askubuntu

This article intends to be reference when importing a openvpn file to NetworkManager on linux

  • Save the files in a folder;
  • Import the .ovpn file with the following command:
@Jeandcc
Jeandcc / getInstagramUsersThatDontFollowBack.js
Last active March 28, 2025 19:12
Open Instagram on your browser; Login to instagram; Open your browser's console (CTRL + SHIFT + J); Paste the code below; Update the username in the first line; RUN IT (Hit enter)
const username = "USER_NAME_HERE";
/**
* Initialized like this so we can still run it from browsers, but also use typescript on a code editor for intellisense.
*/
let followers = [{ username: "", full_name: "" }];
let followings = [{ username: "", full_name: "" }];
let dontFollowMeBack = [{ username: "", full_name: "" }];
let iDontFollowBack = [{ username: "", full_name: "" }];
@fmartins-andre
fmartins-andre / useDebouncedFn.ts
Created October 24, 2022 16:25
Debounce a React.js function
import { DebouncedFunc } from "lodash"
import debounce from "lodash.debounce"
import { useMemo } from "react"
export default function useDebouncedFn<T extends (...args: any[]) => void>(fn: T, wait?: number) {
return useMemo(() =>(
debounce((...args:any[]) => {fn(...args)}, wait ?? 300) as DebouncedFunc<T>
), [fn, wait])
}
@pietersp
pietersp / hybrid_gpu_archcraft_laptop_setup.md
Last active March 6, 2025 20:51
Archcraft linux setup on Intel/Nvidia hybrid laptop

Setting up my Hybrid graphics Laptop with Archcraft Linux

Setting up hybrid graphics linux is generally painful with the current state of Nvidia support. If you can avoid getting an Nvidia GPU based laptop if you plan to use Linux. I use a distro called Archcraft and had some issues specific to my setup (distro/hardware)

The hardware I am installing this on is a TongFang GM6TG7W (aka Wootbook Extreme IV). It has an Intel iGPU and an Nvidia 3070 Max-Q dGPU.

# Salvar num arquivo ~/encode.sh, conceder direito de execução e
# executar desta forma (adaptar nomes de diretórios e arquivos para seu caso):
# $ ~/encode.sh ~/Video/bigFile.mp4 ~/Video/smallFile.mp4
ffmpeg -i "$1" -vcodec h264 -acodec aac "$2"