Skip to content

Instantly share code, notes, and snippets.

View dolmen's full-sized avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
@dolmen
dolmen / which.cmd
Created August 27, 2010 16:42
'which' command for Win32
@echo off
:: Copyright © 2010-2011 Olivier Mengu‚
::
:: This program is free software: you can redistribute it and/or modify
:: it under the terms of the GNU General Public License as published by
:: the Free Software Foundation, either version 3 of the License, or
:: (at your option) any later version.
::
:: This program is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
@dolmen
dolmen / git-go-aliases.sh
Last active August 5, 2024 15:47
Git aliases for Go developement #golang #git
# git go-version: shows the Go-modules versionning formatting of a Git commit
git config --global alias.go-version '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -1 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:v0.0.0-%cd-%h'\'' "$@" ;};f'
# git go-get: shows the command to run on another Go project to upgrade this module
git config --global alias.go-get '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -1 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:go get '\''"$(go list -m)"'\''@v0.0.0-%cd-%h'\'' "$@" ;};f'
# git go-shortlog: shows the 10 commits in Go-modules versionning style
git config --global alias.go-shortlog '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -10 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:v0.0.0-%cd-%h %s'\'' "$@" ;};f'
@dolmen
dolmen / check-xz-in-homebrew.sh
Last active March 30, 2024 21:08
check-xz-in-homebrew
#!/bin/bash
# Commands to evaluate impact of xz installed via homebrew.
# Author: Olivier Mengué.
# Show info about xz bottle:
brew info xz
# Upgrade xz:
brew update
@dolmen
dolmen / README.md
Last active December 30, 2023 10:25
Check if your Perl 5 stack is vulnerable to the OpenSSL heartbleed bug

Check if your Perl stack is vulnerable to the OpenSSL « heartbleed » bug.

curl -s https://gist.githubusercontent.com/dolmen/10096474/raw/ssl-heartbleed-check.pl | perl
@dolmen
dolmen / GitHub.html
Created November 27, 2023 22:07
How to create an URL shortcut on the Gnome desktop
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://github.com/" />
</head>
<body>
</body>
@dolmen
dolmen / export-wifi-profiles.cmd
Created March 10, 2011 17:54
Export all Windows Wifi profiles (SSID, password) in XML
:: Run with full administrator rights
netsh wlan export profile folder=. key=clear
@dolmen
dolmen / find-pi.md
Last active March 29, 2023 13:50
How to find my Raspberry Pi IP address?

The MAC address of Raspberry Pi are in B8:27:EB:**:**:**. http://hwaddress.com/?q=Raspberry

# Scan the local network to put IPs in the ARP cache
nmap -sn -n $(route | sed -n '/^[1-9]/{s/ .*$//p;q}')/24 >/dev/null
# Look for Pi' MACs in the arp cache
arp -n | grep -i 'b8:27:eb:'
@dolmen
dolmen / README.md
Last active March 9, 2023 17:47
go-redis v9 migration script

Automated go-redis v8 -> v9 migration

About v8 -> v9

https://redis.com/blog/go-redis-official-redis-client/

Usage:

curl https://gist.githubusercontent.com/dolmen/9f5b4b1892588a5a8948a7c8e116660b/raw/dafeeb86c5c1c1fe80499b0c652f218c3c69aebd/migrate-go-redis-v9.sh | bash
@dolmen
dolmen / kh-to-hashcat.go
Last active January 5, 2023 10:40
Convert OpenSSH known_hosts for hashcat processing
/*
kh-to-hashcat allows to convert an OpenSSH known_hosts hashed file to a
format that can be used with hashcat to recover hosts.
Note that as the know_hosts file usually contains multiple keys for each host
it is wise to filter the file to a single key type to filter redundant hashes.
Check this stat:
perl -nE '$c{$1}++ if /^\|1\|[^ ]+ ([^ ]+)/;END{say "$_: $c{$_}" for keys %c}' ~/.ssh/known_hosts