Skip to content

Instantly share code, notes, and snippets.

@ThierryGoubier
ThierryGoubier / morphicBench.st
Last active December 8, 2015 09:59
Morphic Performance Testing
"Morphic Performance Testing v2"
| rand creating deleting hiding showing ellipses |
rand := Random new.
creating :=
[ | m | m := EllipseMorph new.
ellipses add: m.
m color: Color random.
m position: ActiveWorld extent * ((rand next)@(rand next))
].
deleting := [ World removeAllMorphsIn: ellipses].

Comment retarder le progrès scientifique? Le physicien Léo Szilard (qui fut un des acteurs du projet Manhattan) publia un texte prophétique pour décrire comment retarder le progrès scientifique. Ce texte de 1962 est finalement la trame de l'ANR actuelle.

  • ....... mais alors pourquoi ne pas faire quelque chose pour retarder le progrès scientifique?
  • Cela me plairait beaucoup, dit Mark Gable, mais comment m'y prendre?
  • Eh bien, dis-je, je crois que ce ne serait pas très difficile. Ce serait même très facile en fait. Vous pourriez créer une Fondation, dotée de 30 millions de dollars par an. Les chercheurs impécunieux pourraient demander une subvention, à condition que leurs arguments soient convaincants. Organisez dix comités, composés chacun de douze savants, et donnez-leur pour tâche de transmettre ces demandes. Enlevez à leurs laboratoires les savants les plus actifs et nommez-les membres de ces comités. Prenez les plus grands savants du moment et faites-en des présidents aux honoraires de 50 mille dollar
@ThierryGoubier
ThierryGoubier / script.st
Created September 12, 2015 16:57
Refactor: add aMessage to all Character literals
| rewriter |
rewriter := RBParseTreeRewriter new
replace: ' `#aLiteral `{:node | node value isCharacter}'
with: '`#aLiteral aMessage'; yourself.
rewriter executeTree: (RBParser parseExpression: 'Array with: $a asciiValue with: $b with: #c with: d').
rewriter tree formattedCode
@ThierryGoubier
ThierryGoubier / deps.sh
Last active November 22, 2016 16:32
Pharo install script
sudo dpkg --add-architecture i386
sudo apt-get update
# INSTALL BUILD LIBRARIES ======================================================
sudo apt-get --yes install cmake zip bash-completion ruby git xz-utils debhelper devscripts
sudo apt-get --yes install libc6-dev:i386 libasound2:i386 libasound2-dev:i386 libasound2-plugins:i386 libcairo2:i386
sudo apt-get --yes install libssl-dev:i386 libssl1.0.0:i386 libfreetype6-dev:i386 libx11-dev:i386 libsm-dev:i386 libice-dev:i386
sudo apt-get --yes install build-essential gcc-multilib g++
sudo apt-get --yes install libgl1-mesa-dev:i386 libgl1-mesa-glx:i386
@ThierryGoubier
ThierryGoubier / Self and Super methods
Created June 25, 2015 20:55
Searching to remove StringHolder as superclass of CrLfFileEditor
| selfMessages searcher superMessages |
selfMessages := Set new.
searcher := RBParseTreeSearcher new.
searcher
matches: 'self `@message: ``@args'
do: [ :aNode :answer |
((CrLfFileEditor selectors includes: aNode selector) not and: [ StringHolder selectors includes: aNode selector ])
ifTrue: [ selfMessages add: aNode selector ] ].
CrLfFileEditor methods do: [ :e | searcher executeTree: e parseTree initialAnswer: nil ].
selfMessages inspect.
@ThierryGoubier
ThierryGoubier / gist:20a3daf5582780d9e760
Last active August 29, 2015 14:17
Loading from a Baseline in Repo1 with packages in Repo2
Metacello new
baseline: 'MonticelloFileTree';
repository: #('http://smalltalkhub.com/mc/Pharo/Pharo40/main' 'http://smalltalkhub.com/mc/ThierryGoubier/MinimalBaselines40/main');
load
@ThierryGoubier
ThierryGoubier / getPharo40MinimalImage
Created March 26, 2015 09:02
shell script for downloading the pharo 4 minimal image
#!/usr/bin/env bash
# stop the script if a single command fails
set -e
# define an echo that only outputs to stderr
echoerr() { echo "$@" 1>&2; }
# try to use curl if possible
if [[ `which curl 2> /dev/null` ]]; then
DOWNLOAD="curl --silent --location --compressed ";
@ThierryGoubier
ThierryGoubier / getPharo30Image
Created March 25, 2015 18:22
shell script for downloading the latest pharo 3 image
#!/usr/bin/env bash
# stop the script if a single command fails
set -e
# define an echo that only outputs to stderr
echoerr() { echo "$@" 1>&2; }
# try to use curl if possible
if [[ `which curl 2> /dev/null` ]]; then
DOWNLOAD="curl --silent --location --compressed ";
@ThierryGoubier
ThierryGoubier / getPharo40Image
Created March 25, 2015 18:21
get the latest pharo 4 image
#!/usr/bin/env bash
# stop the script if a single command fails
set -e
# define an echo that only outputs to stderr
echoerr() { echo "$@" 1>&2; }
# try to use curl if possible
if [[ `which curl 2> /dev/null` ]]; then
DOWNLOAD="curl --silent --location --compressed ";
@ThierryGoubier
ThierryGoubier / getPharoVMLatest
Created March 25, 2015 18:19
shell script for downloading the latest vm from pharo with the 3.0 sources
#!/usr/bin/env bash
# stop the script if a single command fails
set -e
# define an echo that only outputs to stderr
echoerr() { echo "$@" 1>&2; }
# try to use curl if possible
if [[ `which curl 2> /dev/null` ]]; then
DOWNLOAD="curl --silent --location --compressed ";