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 / rio.coffee
Created February 11, 2012 15:32 — forked from Zenithar/rio.coffee
Checksum RIO (portabilité de numéro de téléphone en France)
# Copiez sur coffeescript.org, onglet "Try CoffeeScript" pour l'exécuter en ligne.
exports = {}
#
# Used to calculate the checksum
# http://fr.wikipedia.org/wiki/Relev%C3%A9_d'identit%C3%A9_op%C3%A9rateur
#
exports.calcChksm = (oo, q, rrrrrr, notel) ->
concatenation = "#{oo}#{q}#{rrrrrr}#{notel}"
ordre = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+"
@dolmen
dolmen / git-patching-workflow.dot
Created May 9, 2011 05:25
My patching workflow with Git (GraphViz)
// 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 / mysql+ssh_employees.sh
Last active July 13, 2021 09:45
mysql wrapper to autologin using settings from ~/.mylogin.cnf, ~/.my.cnf and ~/.ssh/config
#!/bin/bash
# Copyright (c) 2016 Olivier Mengué
# License: Apache 2.0
# The connection settings to use are based on the filename of this script
suffix="$(basename "$0" .sh)"
# Connection through SSH
if [[ "_${suffix:0:9}" = _mysql+ssh ]]; then
@dolmen
dolmen / README.md
Created January 28, 2021 14:31
Get Go module+version string from a commit from GitHub

github-go-version

Usage

github-go-version <owner>/<repo> <commit>
@dolmen
dolmen / git-go-aliases.sh
Last active October 19, 2020 12:29
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-shorlog: 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 / 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 / fix-url.go
Created June 12, 2020 17:12
Fix malformed URL query
// Fix (some kinds of) malformed URLs
package main
import (
"fmt"
"log"
"net/url"
)
@dolmen
dolmen / GSheets-renew.pl
Created January 4, 2016 15:29
Using Google Sheets from Perl 5
#!/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 April 23, 2020 08:29
Design for a Go tool for moving symbols from a package to another: gomvfile

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 / perl-env.cmd
Created April 11, 2011 22:48
Switches environment between ActivePerl and StrawberryPerl
@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