Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
@dolmen
dolmen / which.cmd
Created Aug 27, 2010
'which' command for Win32
View which.cmd
@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
Created Jun 24, 2020
Git aliases for Go developement #golang #git
View git-go-aliases.sh
# git go-version: shows the Go-modules versionning formatting of a Git commit
git config --global alias.go-version '!f(){ 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-shorlog: shows the 10 commits in Go-modules versionning style
git config --global alias.go-shortlog '!f(){ 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 / fix-url.go
Created Jun 12, 2020
Fix malformed URL query
View fix-url.go
// Fix (some kinds of) malformed URLs
package main
import (
"fmt"
"log"
"net/url"
)
@dolmen
dolmen / GSheets-renew.pl
Created Jan 4, 2016
Using Google Sheets from Perl 5
View GSheets-renew.pl
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use GSheets;
use Term::Prompt 'prompt';
my $oauth2 = $GSheets::OAUTH2;
@dolmen
dolmen / gomvfile.md
Last active Apr 23, 2020
Design for a Go tool for moving symbols from a package to another: gomvfile
View gomvfile.md

gomvfile design draft

This is a design draft for a tool (gomvfile) that would allow to migrate a set of symbols from a package to another.

Strategy for symbols migration

  1. Isolate symbols that have to move: move all symbols to migrate into one or multiple separate source files. Those sources must not have depenencies on the internals (private symbols, private struct members) of the rest of the package.
  2. Use gomvfile to migrate the files to the target package

gomvfile

@dolmen
dolmen / README.md
Last active Mar 6, 2020
go-bin-upgrade
View README.md

go-bin-upgrade

Rebuild the binaries you have built in Go module mode installed in $GOPATH/bin.

Usage: go-bin-upgrade [-n] [-v] bin1 [bin2]...

Examples:

  • go-bin-upgrade -n godoc
  • (cd ~/go/bin ; go-bin-upgrade * )
@dolmen
dolmen / git-patching-workflow.dot
Created May 9, 2011
My patching workflow with Git (GraphViz)
View git-patching-workflow.dot
// My Git worflow, when patching external projects
// Copyright (C) 2011 Olivier Mengué. All rights reserved.
// dot -Tpng -o git-patching-workflow.png git-patching-workflow.dot
digraph {
find_repo [ label="Find an interesting project on GitHub (or another Git repository)"];
use [ label="Use, test..." ];
bug_idea [ label="Find a bug or idea for a feature" ];
@dolmen
dolmen / export-wifi-profiles.cmd
Created Mar 10, 2011
Export all Windows Wifi profiles (SSID, password) in XML
View export-wifi-profiles.cmd
:: Run with full administrator rights
netsh wlan export profile folder=. key=clear
@dolmen
dolmen / perl-env.cmd
Created Apr 11, 2011
Switches environment between ActivePerl and StrawberryPerl
View perl-env.cmd
@echo off
setlocal
if "%1"=="" goto :ShowEnv
:SetEnv
if /I "%1"=="SB" set NewPerlDir=C:\strawberry\perl
if /I "%1"=="AS" set NewPerlDir=C:\Perl
@dolmen
dolmen / export-400px.pl
Last active Mar 1, 2019
Nautilus script to convert a photo to reduced width of 400px
View export-400px.pl
#!/usr/bin/env perl
# Install as a Nautilus script:
# perl export-400px.pl --install
#
# Install dependencies:
# sudo aptitude install libimage-exiftool-perl libpath-tiny-perl imagemagick zenity
#
# Author: Olivier Mengué
# Created: Sun Feb 28 20:30:55 2016 +0100
You can’t perform that action at this time.