Skip to content

Instantly share code, notes, and snippets.

@michel47
michel47 / autocrop.pl
Last active January 26, 2016 14:36
Image autocrop
#!perl
use PDL;
my $file = shift || 'example.jpg'; # if no argument is passed use example.jpg
my $thres = 0.40;
# chopping the file path ...
my $s = rindex($f,'/');
my $fpath = ($s > 0) ? substr($f,0,$s) : '.';
my $filename = substr($file,$s+1);
@michel47
michel47 / FFTnd.bat
Created January 26, 2016 15:40
image FFT
@:=' -- $RCSfile: FFTnd.bat,v $
@start c:\strawberry\perl\bin\perl.exe -x -S %0 %* & goto endofperl '; # vim: filetype=perl nowrap
#!perl
# note by doing an FFT I go from spacial domain to frequency domain...
# i.e. bridging the physical world to the spiritual one <3
#
my ($source) = q$Source: /my/perl/script/fftnd.pl $ =~ /: (\S+)/;
eval { our $pwd = Win32::GetCwd() }; # current directory
@michel47
michel47 / de(n)code58.pl
Created January 29, 2016 16:53
Generic string to base n conversion (encode and decode)
#!perl
my $IPFSalphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
if ($0 eq __FILE__) {
my $e = '987654321ABC';
my $a = &decode_base($e,$IPFSalphabet);
printf "%s -> %s\n",$e,unpack('H*',$a);
my $e = &encode_base($a,$IPFSalphabet);
printf "%s -> %s\n",unpack('H*',$a),$e;
@michel47
michel47 / hashslice.pl
Created April 18, 2016 14:47
how to assign a hash table by slice (i.e setting a hash with both the key and value arrays)
#!perl
# how to assign a hash table in parallel
# using the whole slice !!!
# read more : http://perldoc.perl.org/perldata.html
#
# courtersy Michel Combes (@ Advancement of Civilization Effort Org.)
my %hash;
my @array = (1 .. 5);
my @keys = ('a' .. 'e');
@michel47
michel47 / keybase.md
Created August 15, 2020 19:25
keybase claim of id

Keybase proof

I hereby claim:

  • I am michel47 on github.
  • I am michel47 (https://keybase.io/michel47) on keybase.
  • I have a public key whose fingerprint is 5C19 0E40 DE17 68D1 4F55 43F9 02BF B5E1 314C 4080

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am michel47 on github.
  • I am michelc (https://keybase.io/michelc) on keybase.
  • I have a public key whose fingerprint is FAD0 F155 9C15 C16D 1C82 D8F0 1092 2EF0 40B0 11EF

To claim this, I am signing this object:

@michel47
michel47 / .dircolors
Last active October 9, 2020 12:12
change ls gnome terminal colors ... (for better contrast)
# LS_COLORS ($Source: /my/shell/setup/.dircolors$)
# for ANSI color code see also [*](https://en.wikipedia.org/wiki/ANSI_escape_code)
#
# Maintainers: Magnus Woldrich <m@japh.se>,
# Ryan Delaney <ryan.delaney@gmail.com> OpenGPG: 0D98863B4E1D07B6
# Michel G. Combes <michelc@gc-bank.org> OpenGPG:
# URL: https://github.com/trapd00r/LS_COLORS
# Version: 0.254
# Updated: Tue Mar 29 21:25:30 AEST 2016
#
@michel47
michel47 / _jsRedirect.md
Last active December 9, 2020 11:21
IPFS redirector (javascript)
head gist hash qm
6b79faa
5d06c7e30abe8b4e1c1eb31edb34affd
QmSNKruojmACYPRwT3Fx8N5yovZmxBGuWWgrK3uiaD1Z3v
Qmb4Ga8fW5a7X8TUVuGegQFYeFnEkUDMSvLX4U35bv4Goz

Javascript IPFS redirect

@michel47
michel47 / h.jpg
Last active December 26, 2020 09:21
Why Hello
h.jpg
@michel47
michel47 / codepen.html
Created February 27, 2021 22:13
using markdown w/ front-matter for codepen web-page
<p class="codepen" data-height="100%" data-theme-id="light" data-default-tab="html,result" data-user="michel47-the-encoder" data-slug-hash="vYyRYYy" style="height: 597px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Dr I%B7T">
<span>See the Pen <a href="https://codepen.io/michel47-the-encoder/pen/vYyRYYy">
Dr I%B7T</a> by Michel G. Combes (<a href="https://codepen.io/michel47-the-encoder">@michel47-the-encoder</a>)
on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>