Skip to content

Instantly share code, notes, and snippets.

View fmartins-andre's full-sized avatar

André Martins fmartins-andre

View GitHub Profile
@fmartins-andre
fmartins-andre / toggleMic.sh
Last active January 9, 2022 16:58
Toggle microfone capture ON/OFF using command line. Useful with keyboard shortcut.
### reference: https://askubuntu.com/a/576507
on=/usr/share/icons/Adwaita/48x48/status/microphone-sensitivity-high-symbolic.symbolic.png
off=/usr/share/icons/Adwaita/48x48/status/microphone-disabled-symbolic.symbolic.png
amixer set Capture toggle \
&& amixer get Capture | grep '\[off\]' \
&& notify-send "Mic switched OFF" "Mic capture was disabled!" --icon=$off \
|| notify-send "Mic switched ON" "Mic capture was enabled!" --icon=$on
@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:
@fmartins-andre
fmartins-andre / manjaro-font-ligatures-vscode-usersettings.md
Last active August 31, 2023 18:05
Add ZSH font ligatures to VSCode on Manjaro

Add font ligatures to the code editor:

  1. install ttf-firacode-nerd font:
    sudo pacman -S ttf-firacode-nerd
  2. configure it in vscode. add the following line to the user settings.json file:
    "editor.fontFamily": "Fira Code"
@fmartins-andre
fmartins-andre / clear-stored-credentials.ps1
Created June 11, 2021 15:17
Clean stored credentials from Windows Credential Manager via PowerShell.
cmdkey /list | ForEach-Object{if($_ -like "*Destino:*"){ cmdkey /del:($_ -replace " ","" -replace "Destino:","")}}
cmdkey /list | ForEach-Object{if($_ -like "*Target:*"){ cmdkey /del:($_ -replace " ","" -replace "Target:","")}}
@fmartins-andre
fmartins-andre / run_ps1.bat
Created June 11, 2021 15:02
Bat script to run a PowerShell ps1 file that has its name equal the name this script have, bypassing policy restrictions. Useful for logon/logoff scripts.
@echo off
SET FILE=%~dp0%~n0%.ps1
::run powershell script with same name of this file
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%FILE%' %*"
@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 {