Skip to content

Instantly share code, notes, and snippets.

View SergeStinckwich's full-sized avatar
🎯
Focusing

Serge Stinckwich SergeStinckwich

🎯
Focusing
View GitHub Profile
@SergeStinckwich
SergeStinckwich / gist:58f917741ee4e77992ec
Last active August 29, 2015 14:04
Visualization of last 30 days of earthquakes
| b tab |
tab := RTTabTable new input: (ZnEasy get: 'http://earthquake.usgs.gov/earthquakes/feed/v0.1/summary/2.5_month.csv') entity string usingDelimiter: $,.
tab removeFirstRow.
tab replaceEmptyValuesWith: '0' inColumns: #(2 3 4 5).
tab convertColumnsAsFloat: #(2 3 4 5).
b := RTMapLocationBuilder new.
b shape circle
size: [ :v| (2 raisedTo: v) / 2 ];
color: (Color red alpha: 0.3).
tab values do: [ :row | b addPoint: row second @ row third value: row fifth ].
@SergeStinckwich
SergeStinckwich / gist:b84e1f4ae485cda7d6c9
Created August 5, 2014 16:31
Retrieve my avatar picture as a 70*70 jpeg file
(ZnEasy getJpeg: 'http://www.gravatar.com/avatar/',
(ZnDigestAuthenticator md5Hash: 'serge.stinckwich@gmail.com'),'?s=70'
) asMorph openInWorld
@SergeStinckwich
SergeStinckwich / gist:6fe960a6b74ba6257e76
Last active August 29, 2015 14:04
Init script for Pharo images using PharoLauncher (adapted from the one of Torsten Bergmann)
| sharedPackageCacheDirectory |
"Never apply to PharoLauncher itself"
(SmalltalkImage current imageName includesSubstring: 'Launcher') ifTrue: [ ^self ].
"ask if script should be applied"
(UIManager default confirm: 'Apply init script from ', StartupPreferencesLoader preferencesGeneralFolder fullName,' to image') ifFalse: [^self ].
"Use a shared package cache to store Monticello MCS files for all images"
sharedPackageCacheDirectory := (StartupPreferencesLoader preferencesGeneralFolder fullName, 'commonpackage-cache') asFileReference
ensureCreateDirectory;
@SergeStinckwich
SergeStinckwich / gist:8161788
Created December 28, 2013 17:25
Prime Spiral in EyeSee - Pharo
|diag|
diag := ESDiagramRenderer new.
(diag scatterplot)
models: ((0 to: 5e4) select:#isPrime);
y: [ :p |(p* (p cos))];
x: [ :p |(p* (p sin))];
preferredAxisMinX:(-50000);
preferredAxisMinY:(-50000);
smallObjects.
diag open.
@SergeStinckwich
SergeStinckwich / gist:5337643
Created April 8, 2013 15:24
docpad on Ubuntu 12.04
#Install npm
sudo apt-get install npm
#Ensure the lastest version of npm is installed
sudo npm install -g npm
#Install docpad 6.30
npm install -g docpad@6.30
@SergeStinckwich
SergeStinckwich / gist:5337581
Created April 8, 2013 15:17
ZeroConf Pharo scripts
# Download Pharo 2.0 + VM
```bash
wget -O - get.pharo.org/20+vm | bash
```
# Download Pharo 3.0 + VM
```bash
wget -O - get.pharo.org/30+vm | bash
import java.lang.reflect.*;
import java.beans.*;
public class FluentInterface<T> implements InvocationHandler {
Object obj;
public FluentInterface(Object obj) {
this.obj = obj;
}
@SergeStinckwich
SergeStinckwich / gist:4707579
Created February 4, 2013 15:51
public static boolean isAnAnagram(String c1, String c2)
class Exo3 {
public static boolean isAnAnagram(String c1, String c2){
int [] counts = new int[26];
int l1 = c1.length();
int l2 = c2.length();
if (c1.equals(c2)) return true;
if (l1 != l2) return false;
@SergeStinckwich
SergeStinckwich / travis-upload.bash
Created June 7, 2012 06:55
Send a file to dl.free.fr from travis-ci
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: $0 <file>"
exit 1
fi
name=test$RANDOM@test$RANDOM.fr
pass=$RANDOM
file="$1"
out=$(mktemp)
##############################################################
japanino.name=Gakken Japanino(学研 大人の科学 ジャパニーノ)
japanino.upload.protocol=stk500
japanino.upload.maximum_size=14336
japanino.upload.speed=19200
japanino.bootloader.low_fuses=0xe2
japanino.bootloader.high_fuses=0xdd