Skip to content

Instantly share code, notes, and snippets.

View Uko's full-sized avatar
😎
zajebiście

Yuriy Tymchuk Uko

😎
zajebiście
View GitHub Profile
colorChangeIndex := self detectIndex: [ :s | s = '; PRINT_COLOR_CHANGE' ].
startLines := self first: colorChangeIndex-1.
restLines := self allButFirst: colorChangeIndex + 1.
layerChangeIndex := restLines detectIndex: [ :s | s = ';AFTER_LAYER_CHANGE' ].
endLines := restLines allButFirst: layerChangeIndex.
layerLines := restLines first: layerChangeIndex.
top_d = 107;
wider_ridge_d = 100;
narrower_ridge_d = 92;
bottom_d = 78;
top_h = 18;
h = 80;
@Uko
Uko / PharoWriteFile.st
Created November 26, 2013 15:47
Writing data to file in Pharo
(FileSystem disk workingDirectory / 'temp.txt') writeStream
nextPutAll: 'string to write in file';
close
@Uko
Uko / mast
Created October 2, 2018 08:44
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name mastodon-test.tymchuk.me;
root /home/mastodon/live/public;
@Uko
Uko / autosave.st
Last active June 17, 2018 10:48
Autosave Pharo image every 10 mins
[
Transcript open.
[true] whileTrue: [
WorldState addDeferredUIMessage: [
SmalltalkImage current saveSession].
(Delay forSeconds: 60) wait]
] forkNamed: 'autosave'
| methods size |
methods := (RPackage organizer packages select: [ :p | p packageManifestOrNil isNil]) flatCollect: #methods.
size := methods size *
(ReRuleManager uniqueInstance methodRules size +
ReRuleManager uniqueInstance nodeRules size).
(1 to: 10) collect: [ :x |
[ methods do: [ :m | m critiques ] ] timeToRunWithoutGC / size ].
| all dict reverseDict filtered |
"get data from db"
all := (MooseModel root first allAuthors collect: #name) asArray.
"get author relations data"
dict := STON fromString:
(ZnClient new get: 'https://raw2.github.com/Uko/SHubAuthors/master/SHubAuthors.ston').
"create reverse dictionary"
@Uko
Uko / completion.st
Last active December 29, 2015 12:48
My prefs for pharo. Files should reside in ~/Library/Preferences/pharo/
StartupLoader default executeAtomicItems: {
StartupAction
name: 'Code completion setings'
code: [
NECPreferences
enabled: true;
popupShowAutomatic: true;
useController: NECController;
popupShowWithShortcut: Character space shift ]
runOnce: true
@Uko
Uko / convert
Last active December 26, 2015 09:59
Generate movie from slides with ffmpeg
width=1920
height=1080
ffmpeg -i visualization/%d.png -c:v libx264 -filter:v "scale=iw*min($width/iw\,$height/ih):ih*min($width/iw\,$height/ih), pad=$width:$height:($width-iw*min($width/iw\,$height/ih))/2:($height-ih*min($width/iw\,$height/ih))/2:0xFFFFFF" -pix_fmt yuv420p z.mov
@Uko
Uko / loadBaseline.st
Last active December 25, 2015 01:59
To load some project with configuration from gofer
Metacello new
baseline: #Project;
repository: 'github://Uko/Project:branch';
load