Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabienhinault
fabienhinault / vimhelp.bash
Created October 13, 2020 19:29
put diff result inside french translation
rm *.sed
rm xx*
for f in $(ls *.txt)
do
echo $f
NEN=$(wc -l ../../../vim63/doc/${f%%.*}.txt | cut -f 1 -d ' ' )
NFR=$(wc -l ../../../vim63/doc/fr/${f%%.*}.frx | cut -f 1 -d ' ' )
if (( $NFR < $NEN ))
then
NFR=$NEN
@fabienhinault
fabienhinault / line_length.txt
Last active January 21, 2020 12:39
line_length
1234567 10 234567 20 234567 30 234567 40 234567 50 234567 60 234567 70 234567 80 234567 90 23456 100 23456 110 23456 120 23456 130 23456 140 23456 150 23456 160 23456 170 23456 180 23456 190 23456 200 23456 210 23456 220 23456 230 23456 240 23456 250 23456 260 23456 270 23456 280 23456 290 23456 300 23456 310 23456 320 23456 330 23456 340 23456 350 23456 360 23456 370 23456 380 23456 390 23456 400
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 8901234567890123456789012345678901234567890123456789012345678901234567890
000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222 2233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
import random
import math
NOMBRE_EQUIPES = 4
def complementMultiple(n, mult):
remainder = n % mult
if (remainder == 0):
return 0
<?xml version="1.0" encoding="UTF-8"?>
<opml>
<body>
<outline text="TED Radio Hour" type="rss" xmlUrl="http://www.npr.org/rss/podcast.php?id=510298" />
<outline text="BBC Radio Podcasts" type="include" url="http://www.bbc.co.uk/podcasts.opml" />
<outline text="gpodder.net - Python" type="include" url="http://gpodder.net/search.opml?q=Python" />
<outline text="Les cours du college de France" type="rss" xmlUrl="http://radiofrance-podcast.net/podcast09/rss_11921.xml" />
<outline text="Questions d'islam" type="rss" xmlUrl="http://radiofrance-podcast.net/podcast09/rss_11921.xml" />
<outline text="La methode scientifique" type="rss" xmlUrl="http://radiofrance-podcast.net/podcast09/rss_14312.xml" />
<outline text="Beaumarchais" type="rss" xmlUrl="http://radiofrance-podcast.net/podcast09/rss_20178.xml" />
#/usr/bin/env bash
_docurl_completions()
{
IFS=" \t\n"
# COMPREPLY=($(compgen -W "$(history | grep curl | sed "s/\$(\||\|)/\n/g" | grep curl | tail -n 100)" -- "${COMP_WORDS[$COMP_CWORD]}" | sort | uniq ))
COMPREPLY=($(compgen -W "$(history | cut -d ' ' -f2- | grep curl | sed 's/\$(\||\|)/\n/g' | grep curl | tail -n 200 | tr " " "\n" | sort | uniq | cut -c -200 | tr "\n" " ")" -- "${COMP_WORDS[$COMP_CWORD]}"))
}
complete -F _docurl_completions curl
@fabienhinault
fabienhinault / tabname-def.bash
Created July 24, 2019 13:01
method to use to rename terminal tab when using a command.
tabname() {
if [[ $PROMPT_COMMAND =~ echo\ -en\ \"\\033]0\;\ $1\ \\a\"$ ]]
then
return 0
else
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }echo -en \"\\033]0; $1 \\a\""
return 1
fi
}
@fabienhinault
fabienhinault / toJsonString.java
Created October 9, 2018 11:14
get object json string
new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(o)
@fabienhinault
fabienhinault / 8_queens.rkt
Last active August 5, 2018 22:56
8 queens puzzle solver
#lang racket
(define-syntax-rule (let1 a b body ...)
(let ((a b)) body ...))
(require rackunit)
(define (diag-asc q)
(- (car q) (cdr q)))