Skip to content

Instantly share code, notes, and snippets.

@cmuller
cmuller / googlegame.tcl
Created February 24, 2012 08:38
Testing gist.. :-). this is an impl for a dev game from google (2004).. The site found does not exist anymore.. so we get a DNS error.
set s 7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648
set len [ string len $s ]
set last [ expr $len-10 ]
set prime_not_yet_found 1
proc primetest { n } {
set max [ expr wide(sqrt($n)) ]
if { $n%2==0 } {
return [ list 2 [ expr $n/2 ] ]
@cmuller
cmuller / gist:5134993
Last active December 14, 2015 19:09
A 'sed' command to switch from (# and ##) markdown titles to (=== and ----) underlined ones

I'm always surprised by the power and concision of sed! The only problem being able to find the (few) characters that do what I want :-)

aaronsw's html2text is doing a fine job converting html to markdown, but I prefer the underlined format for h1 and h2 titles as it is prettier (imho) when viewing the ascii code, so, here comes sed:

./html2text.py <url> | sed -e '/^# / {s/^# //p;s/./=/g}' -e '/^## / {s/^## //p;s/./-/g}' > url.md
@cmuller
cmuller / gist:8913577
Last active July 24, 2020 08:52
How to deal with Testlink Cookies Exceeding Limits

How to deal with Testlink Cookies Exceeding Limits

Symptom

When you cannot login any more in Testlink because of the following error:

Bad Request

Your browser sent a request that this server could not understand.

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@cmuller
cmuller / matrix1.md
Last active May 7, 2024 14:19
Matrix Synapse : how to prevent users from creating rooms or communities

Matrix Synapse : how to prevent users from creating rooms or communities

This can be useful for admins running local synapse servers.

Forbid Group/Community creation

in order to prevent users from creating communities, there is an option: put in your /matrix/synapse/config/homeserver.yaml file:

@cmuller
cmuller / python-request.md
Last active November 29, 2020 21:02
How to use Requests in python2.7 in Ubuntu 20.04

How to use Requests in python2.7 in Ubuntu 20.04

python-request package has been dropped in Ubuntu 20.04

According to https://packages.ubuntu.com/eoan/python-requests, the python-request package has been dropped after Ubuntu Eoan (19.10) => The package is no more available on Ubuntu focal (20.04)

As a consequence you can have legacy Python2 code that ends up with this type of error: