Skip to content

Instantly share code, notes, and snippets.

@strarsis
strarsis / howto.md
Last active March 26, 2025 16:51
KeeAgent (for KeePass) on Bash on Windows / WSL (2)

Update (March 2023) (Last checked: Oktober 2024)

Side note: The latest edge build of KeeAgent plugin offers an option for creating a WSL compatible socket. This would be very handy. I already tried to use that socket, but the socket file is currently empty and ssh inside WSL 2 is unable to use it. This appears to be a very new, unreleased and unstable feature. I will follow the development of it and when it finally works (well, for me) I will update this HOWTO. But until then, please use the proven wsl-ssh-agent/npiperelay.exe approach below.

Thanks to the instructions for WSL 2 of the wsl-ssh-agent project, KeeAgent works great in WSL 2 now: https://github.com/rupor-github/wsl-ssh-agent#wsl-2-compatibility The approach uses minimal and well-maintained tools.

Mini-changelog

##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@mikesparr
mikesparr / gcp-project-migrate-org-to-org.sh
Last active March 26, 2025 16:51
Example gcloud commands to migrate a Google Cloud Project from organization to organization
#!/usr/bin/env bash
#####################################################################
# REFERENCES
# - https://cloud.google.com/resource-manager/docs/project-migration
# - https://olivelink.net/blog/migrating-google-cloud-projects-between-organisations-a-step-by-step-guide (console)
#####################################################################
# vars
export SOURCE_ORG="<SOURCE-ORG-ID>" # get from `gcloud organizations list`
#let typ(body) = html.elem(
"typ",
{
// distinguish parbreak from <p> tag
show parbreak: it => html.elem("typParbreak", "")
show linebreak: it => html.elem("typLinebreak", "")
show strong: it => html.elem("typStrong", it.body)
show emph: it => html.elem("typEmph", it.body)
show highlight: it => html.elem("typHighlight", it.body)
@tezzutezzu
tezzutezzu / data.csv
Last active March 26, 2025 16:45
nomi italiani
We can't make this file beautiful and searchable because it's too large.
name,rank,year,count,gender,percent
ANDREA,1,1999,10336,m,3.914617704
FRANCESCO,2,1999,9494,m,3.595721796
ALESSANDRO,3,1999,9000,m,3.408626096
MATTEO,4,1999,8703,m,3.296141435
LUCA,5,1999,7799,m,2.953763881
LORENZO,6,1999,7499,m,2.840143011
MARCO,7,1999,7002,m,2.651911103
DAVIDE,8,1999,6418,m,2.430729143
@diogorusso
diogorusso / 0.0_local-env.md
Last active March 26, 2025 16:44
Checking and Installing Xcode Command Line Tools

MacOS dev env setup

  • X-Code command line + .bash_profile
  • Homebrew + Brewfile
  • GIT + Github
  • Ruby + RVM + Bundler
  • mySQL
  • Python + Pyenv + Pyenv-Virtualenvwrapper
  • Node + NPM + Yarn + N + NCU
  • Webpack , Gulp
@XPlantefeve
XPlantefeve / WinHttpProxySettings.ps1
Last active March 26, 2025 16:44
netsh winhttp * proxy, but in PowerShell
# Quick & dirty. Basic error checking. It works where I needed it.
#
# Documentation used:
# - ProcMon
# - https://securelink.be/blog/windows-proxy-settings-explained/
# - https://docs.microsoft.com/en-us/windows/desktop/api/Winhttp/ns-winhttp-__unnamed_struct_3
# - https://github.com/vbfox/proxyconf/blob/master/README.md
# - https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/managing-bit-flags-part-1
# - https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_enum
#
@Maetih
Maetih / gist:2718d0e0a23940d8cb0e6a9235adddd8
Last active March 26, 2025 16:43
samsung-bloatware-apps-android-14
Goal: Improve privacy by minimizing system data traffic to Samsung, Google, 3rd party internet companies
Method: Remove pre-installed system apps, bloatware, talking back home via `adb shell pm uninstall --user 0 <PACKAGE_NAME>`
Boundary condition: No root, maintain system stability, security and updates, keep work profile
Tested device: Samsung tablet/phablet SM-T225 Galaxy Tab A7 Lite LTE
Tested OS versions: Samsung stock ROM, Android V. 12-14
Applicability: Should also work on other recent Samsung smartphones, tablets running the same stock ROMs
Success:
Not counting closed portal connectivity checks, regular background system connections were reduced to the following
domains - to be blocked by a firewall, if desired:
@grumpyshoe
grumpyshoe / build.gradle
Created March 11, 2019 19:34
Gradle: how to get git hash in build.gradle
String getGitHash() {
// git hash
def command = Runtime.getRuntime().exec("git rev-parse --short HEAD")
def result = command.waitFor()
if (result != 0) {
throw new IOException("Command 'getGitHash()' exited with " + result)
}
String gitCommitHash = command.inputStream.text.trim()

Security Checklist

Configuration Security

  • Store secrets in environment variables or dedicated secret management systems
  • Never commit secrets to version control
  • Implement secret rotation policies
  • Use different credentials for different environments
  • Encrypt sensitive configuration values

Authentication & Authorization