Compare commits

...

494 commits

Author SHA1 Message Date
Yann Esposito (Yogsototh) 0fd3c7ec03
back to hoefler text 2024-04-22 10:41:38 +02:00
Yann Esposito (Yogsototh) efc0681162
dangerous road 2024-03-19 11:40:26 +01:00
Yann Esposito (Yogsototh) b9f98378ca
Improved Troll 2 specific CSS 2024-03-12 11:04:07 +01:00
Yann Esposito (Yogsototh) 1aec225c9c
minor css fix 2024-03-08 13:54:16 +01:00
Yann Esposito (Yogsototh) adc6d36ca4
typo 2024-03-08 13:51:59 +01:00
Yann Esposito (Yogsototh) 95448fa293
Changed my preference on fonts 2024-03-08 11:45:28 +01:00
Yann Esposito (Yogsototh) 434bdbea2c
last minute update before deploying 2024-03-08 11:26:52 +01:00
Yann Esposito (Yogsototh) 92d7c0e6bd
fuck cors article 2024-03-08 11:18:42 +01:00
Yann Esposito (Yogsototh) 530645cae8
new vids 2023-11-15 11:45:53 +01:00
Yann Esposito (Yogsototh) 7d9abd7a43
added money money money 2023-11-15 09:46:29 +01:00
Yann Esposito (Yogsototh) c303d06449
upgrade deps 2023-11-14 22:40:35 +01:00
Yann Esposito (Yogsototh) ff9b6648ee
Added JE L'AI FAIT 2023-07-07 16:18:17 +02:00
Yann Esposito (Yogsototh) 7dd1f68bed
s/twitter/mastodon/ 2023-06-30 22:54:00 +02:00
Yann Esposito (Yogsototh) 93693e9871
removed twitter for mastodon 2023-06-04 08:09:04 +02:00
Yann Esposito (Yogsototh) f8bd6be63e
les vieux 2023-06-02 12:19:09 +02:00
Yann Esposito (Yogsototh) 060055bc04
fix a building bug 2023-05-10 08:43:47 +02:00
Yann Esposito (Yogsototh) 445fb242c1
cleanup old about-me 2023-05-10 08:39:11 +02:00
Yann Esposito (Yogsototh) b524e83144
Take advantage of eval in Makefile 2023-04-20 00:26:51 +02:00
Yann Esposito (Yogsototh) f8b5487e65
fix font size 2023-04-17 12:02:35 +02:00
Yann Esposito (Yogsototh) 11545d5ab7
composable nix shell 2023-03-02 11:37:17 +01:00
Yann Esposito (Yogsototh) a427dbd8bb
moved from mastodon.social to ieji.de 2023-02-08 17:27:01 +01:00
Yann Esposito (Yogsototh) 4e340783f1
add mastodon 2022-12-21 14:59:30 +01:00
Yann Esposito (Yogsototh) 08a1f190d1
chat-gpt test 2022-12-11 22:56:49 +01:00
Yann Esposito (Yogsototh) d32002c573
minor font fix 2022-11-06 14:37:16 +01:00
Yann Esposito (Yogsototh) 2a1dbe6c9e
mark archived articles as such 2022-10-27 14:33:35 +02:00
Yann Esposito (Yogsototh) 059fabd7d0
many minor details to update 2022-10-26 11:38:50 +02:00
Yann Esposito (Yogsototh) 82db423114
minor look and feel update for legacy articles 2022-10-26 11:29:40 +02:00
Yann Esposito (Yogsototh) f4675e7130
remove ada block 2022-10-26 11:26:21 +02:00
Yann Esposito (Yogsototh) a0da29f53b
origami mon ami 2022-10-23 20:40:43 +02:00
Yann Esposito (Yogsototh) 847c80a63f
move from memes to mem 2022-10-23 20:24:42 +02:00
Yann Esposito (Yogsototh) fa11add4f8
page for each video 2022-10-11 12:29:51 +02:00
Yann Esposito (Yogsototh) 3616b1685d
added a few video memes 2022-10-11 10:42:58 +02:00
Yann Esposito (Yogsototh) 20ec6b1023
a slightly better mobile compatible 2022-10-06 17:28:14 +02:00
Yann Esposito (Yogsototh) cce2fa901d
svg play 2022-09-29 14:47:52 +02:00
Yann Esposito (Yogsototh) f47cabff24
changed look and feel 2022-09-29 14:30:17 +02:00
Yann Esposito (Yogsototh) fc0249f599
hide link text 2022-09-29 11:37:36 +02:00
Yann Esposito (Yogsototh) 6b5600964c
fix toc CSS 2022-09-29 11:28:06 +02:00
Yann Esposito (Yogsototh) ae8c688903
try at accessibility improvements 2022-09-29 11:25:56 +02:00
Yann Esposito (Yogsototh) b94c8a620d
accessibilitytest.org 2022-09-28 20:05:46 +02:00
Yann Esposito (Yogsototh) b17f1fa12d
fix typo 2022-09-12 10:52:41 +02:00
Yann Esposito (Yogsototh) 3a8baeb5d4
updated style modification for utopia 2022-06-19 18:20:43 +02:00
Yann Esposito (Yogsototh) 2f610f2b20
system font advice + colors 2022-06-19 18:09:41 +02:00
Yann Esposito (Yogsototh) 1163f5352b
removed a tag 2022-05-06 15:19:31 +02:00
Yann Esposito (Yogsototh) 8536464fec
Org agenda on start page 2022-05-06 14:57:58 +02:00
Yann Esposito (Yogsototh) 4b0d69af9e
minor fix 2022-02-21 08:40:30 +01:00
Yann Esposito (Yogsototh) 27c59db5b0
fix legacy css 2022-02-19 10:54:12 +01:00
Yann Esposito (Yogsototh) 13c4640cf1
improve server content-type 2022-02-19 10:42:58 +01:00
Yann Esposito (Yogsototh) e0e583b050
better index page 2022-02-19 10:36:55 +01:00
Yann Esposito (Yogsototh) 7c692878bc
new styling 2022-02-19 10:06:23 +01:00
Yann Esposito (Yogsototh) 887a590f7e
styling 2022-02-19 09:48:39 +01:00
Yann Esposito (Yogsototh) 0dd91cb23a
fix bad idea 2022-01-21 23:37:09 +01:00
Yann Esposito (Yogsototh) bc4c4c7763
code gen fix 2022-01-20 23:22:12 +01:00
Yann Esposito (Yogsototh) 60392ea438
try to have better readability 2022-01-20 10:37:43 +01:00
Yann Esposito (Yogsototh) 444548b8f5
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2021-11-16 11:15:06 +01:00
Yann Esposito (Yogsototh) cd94e215d4
Improve dev.sh script 2021-11-15 09:07:40 +01:00
Yann Esposito (Yogsototh) 7236ef6b7a
fix bug optim img 2021-11-02 18:31:33 +01:00
Yann Esposito (Yogsototh) fe1b6a0776
improved dev.sh 2021-11-02 16:09:09 +01:00
Yann Esposito (Yogsototh) 7aa04bee54
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2021-10-30 12:37:36 +02:00
Yann Esposito (Yogsototh) 4cc82bf954
updated the post 2021-10-30 12:36:54 +02:00
Yann Esposito (Yogsototh) 3171031eea
Personal dot files explained 2021-10-30 12:31:09 +02:00
Yann Esposito (Yogsototh) fc70b4acf4
Better html / gmi 2021-10-24 23:54:20 +02:00
Yann Esposito (Yogsototh) 23039ebee9
Added video and comments 2021-10-24 15:27:16 +02:00
Yann Esposito (Yogsototh) 9c6a997cdb
iA writer clone article 2021-10-24 15:04:36 +02:00
Yann Esposito (Yogsototh) 72f79ad842
Fix github pages links 2021-10-08 16:16:02 +02:00
Yann Esposito (Yogsototh) 1c9352bb2b
troll 2 background green 2021-10-03 22:23:12 +02:00
Yann Esposito (Yogsototh) 370e0a6ee7
play with metas and color theme html 2021-10-03 22:20:41 +02:00
Yann Esposito (Yogsototh) 5e7bca80ad
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2021-10-03 15:47:49 +02:00
Yann Esposito (Yogsototh) d937afc208
webp
todo: fix gif
2021-10-03 15:46:05 +02:00
Yann Esposito (Yogsototh) 78db14d6fb
color-theme for Safari 2021-09-30 14:12:12 +02:00
Yann Esposito (Yogsototh) 2bffa4154b
Engine bug fixes and cleanup 2021-09-26 15:46:52 +02:00
Yann Esposito (Yogsototh) 736b8e39b6
lighttpd + org-links with lua 2021-09-20 14:09:52 +02:00
Yann Esposito (Yogsototh) 2acd6effce
A bit of re-reading my article. 2021-09-01 14:33:37 +02:00
Yann Esposito (Yogsototh) 09b0af122a
update 2021-08-22 08:42:12 +02:00
Yann Esposito (Yogsototh) a4ad837b8f
bonus section 2021-08-21 23:14:31 +02:00
Yann Esposito (Yogsototh) a0788c624e
article 2021-08-21 23:07:50 +02:00
Yann Esposito (Yogsototh) 8081c2c1f8
l337 2021-08-21 22:34:51 +02:00
Yann Esposito (Yogsototh) 11fce6a2b1
Fix engine + wip 2021-08-21 18:04:11 +02:00
Yann Esposito (Yogsototh) e24aa4d479
portability improvements 2021-08-21 17:19:30 +02:00
Yann Esposito (Yogsototh) c13516e0b0
delete drafts 2021-07-12 08:46:19 +02:00
Yann Esposito (Yogsototh) b6f4e8bf32
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2021-07-07 14:49:50 +02:00
Yann Esposito (Yogsototh) 012d5f14eb
Improved org2gemini 2021-06-21 14:05:31 +02:00
Yann Esposito (Yogsototh) 01d00491cd
fix font for iOs for the troll2 2021-06-21 10:35:52 +02:00
Yann Esposito (Yogsototh) d9c7cd3fba
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2021-06-21 10:34:04 +02:00
Yann Esposito (Yogsototh) f9646d62f5
yellow img 2021-06-21 00:11:02 +02:00
Yann Esposito (Yogsototh) e0a8dd126b
minor css detail 2021-06-20 18:57:54 +02:00
Yann Esposito (Yogsototh) 35ce280d6b
dark mode l337 2021-06-20 18:55:44 +02:00
Yann Esposito (Yogsototh) 0d6310e5f2
dark mode mess fix 2021-06-20 18:52:57 +02:00
Yann Esposito (Yogsototh) f52149fc3a
improve utopia article look 2021-06-20 18:48:56 +02:00
Yann Esposito (Yogsototh) 8649f64528
custom CSS for a few articles 2021-06-20 17:26:45 +02:00
Yann Esposito (Yogsototh) 8f410ec372
updated forcePaste 2021-06-17 10:28:31 +02:00
Yann Esposito (Yogsototh) e6b1789b02
updated link to spanish translation 2021-06-14 22:15:58 +02:00
Yann Esposito (Yogsototh) bd8e0522b3
Slightly improved css 2021-06-10 19:13:04 +02:00
Yann Esposito (Yogsototh) 83001ea774
Slightly update css 2021-06-10 19:03:19 +02:00
Yann Esposito (Yogsototh) e73e0fa702
image optim 2021-06-10 18:11:25 +02:00
Yann Esposito (Yogsototh) 27e78c194b
batch of changes to be tested 2021-06-03 00:48:41 +02:00
Yann Esposito (Yogsototh) 803e7c2a43
Externalize image optim to a script 2021-06-02 12:24:22 +02:00
Yann Esposito (Yogsototh) f83248503d
reworkding a bit, remove specific CSS rule 2021-06-02 12:11:49 +02:00
Yann Esposito (Yogsototh) f7ca66102d
cleanup my style 2021-06-01 23:14:57 +02:00
Yann Esposito (Yogsototh) 2a6f814c6d
fix article and script 2021-06-01 18:26:04 +02:00
Yann Esposito (Yogsototh) cbcff38c99
utopia 2021-06-01 18:05:04 +02:00
Yann Esposito (Yogsototh) dcfe493cc8
Prepare for a new entry. 2021-06-01 11:07:12 +02:00
Yann Esposito (Yogsototh) 0426e4a03c
helpers 2021-05-26 23:06:17 +02:00
Yann Esposito (Yogsototh) 9ce3afee97
Update and deploy 2021-05-26 07:58:35 +02:00
Yann Esposito (Yogsototh) eca0cc19c7
fix bug 2021-05-25 22:31:19 +02:00
Yann Esposito (Yogsototh) 03610908ce
Old site match new style 2021-05-25 22:25:47 +02:00
Yann Esposito (Yogsototh) 99d992950c
updated logo 2021-05-25 21:30:03 +02:00
Yann Esposito (Yogsototh) 9fe1ef3498
wip 2021-05-25 17:43:43 +02:00
Yann Esposito (Yogsototh) bb24585590
Improve index generation 2021-05-25 16:27:58 +02:00
Yann Esposito (Yogsototh) 2ca69dbab5
Updated Look & Feel 2021-05-25 10:41:36 +02:00
Yann Esposito (Yogsototh) bf2387bb68
Link my old archives 2021-05-25 10:25:11 +02:00
Yann Esposito (Yogsototh) dba9ae1393
Improve a bit of everything prepare article 2021-05-24 18:50:27 +02:00
Yann Esposito (Yogsototh) d939ae3f33
still use background for pre/code 2021-05-24 15:54:47 +02:00
Yann Esposito (Yogsototh) 1dd8138466
many small fixes 2021-05-24 15:40:47 +02:00
Yann Esposito (Yogsototh) 8c5a4fc093
draft on meta 2021-05-21 19:36:05 +02:00
Yann Esposito (Yogsototh) 8e2cb330f9
playing a bit with Makefile 2021-05-17 23:27:37 +02:00
Yann Esposito (Yogsototh) c06d1afecb
still css tweaks 2021-05-16 13:32:44 +02:00
Yann Esposito (Yogsototh) 61b6b9e794
css tweaks 2021-05-16 00:38:26 +02:00
Yann Esposito (Yogsototh) 20dcec0ebd
not ready article 2021-05-10 00:20:13 +02:00
Yann Esposito (Yogsototh) 50ebc7501c
css tweak 2021-05-10 00:17:37 +02:00
Yann Esposito (Yogsototh) 1b7f0d98e7
minor fixes 2021-05-09 21:41:34 +02:00
Yann Esposito (Yogsototh) bc5afe8cd1
CSS fix 2021-05-09 19:50:53 +02:00
Yann Esposito (Yogsototh) debfc13228
Improve makefile by writing a blog 2021-05-09 17:32:15 +02:00
Yann Esposito (Yogsototh) 983b3c8def
Improve makefile 2021-05-09 17:15:52 +02:00
Yann Esposito (Yogsototh) e4c3a308e5
improved CSS and support toc 2021-05-09 12:11:33 +02:00
Yann Esposito (Yogsototh) 23b980eff0
fix links bugs 2021-05-08 13:33:14 +02:00
Yann Esposito (Yogsototh) c56449b1d5
fix build bug 2021-05-08 13:22:36 +02:00
Yann Esposito (Yogsototh) 9fdc163fc5
fix index script 2021-05-08 10:33:02 +02:00
Yann Esposito (Yogsototh) fb993d8928
parallized rss build 2021-05-08 10:07:10 +02:00
Yann Esposito (Yogsototh) 2252391159
Try to parallelize RSS building better 2021-05-07 18:02:58 +02:00
Yann Esposito (Yogsototh) 1e727b5d2b
support slides 2021-05-07 17:22:57 +02:00
Yann Esposito (Yogsototh) 78c176d73e
so much simpler 2021-05-07 00:21:41 +02:00
Yann Esposito (Yogsototh) 771a21ff3e
cleanup template 2021-05-06 10:54:28 +02:00
Yann Esposito (Yogsototh) 344620e35c
cleanup 2021-05-06 10:35:05 +02:00
Yann Esposito (Yogsototh) 07a882a537
cleaner output and fix missing rules in makefile 2021-05-06 10:01:07 +02:00
Yann Esposito (Yogsototh) 3a6587a3ef
dark theme css support 2021-05-06 09:13:13 +02:00
Yann Esposito (Yogsototh) 03db1aaea7
goodies 2021-05-05 23:35:53 +02:00
Yann Esposito (Yogsototh) b151370ba7
better index for gmi 2021-05-02 21:24:37 +02:00
Yann Esposito (Yogsototh) c925082fa0
simpler, lack of bugs 2021-05-02 21:15:12 +02:00
Yann Esposito (Yogsototh) b4a2c9cdfe
fix failing commment 2021-05-02 11:28:27 +02:00
Yann Esposito (Yogsototh) 23fc0738fc
improved org2gemini 2021-05-02 11:26:51 +02:00
Yann Esposito (Yogsototh) d168d0b28e
fix org2gemini 2021-05-02 11:17:38 +02:00
Yann Esposito (Yogsototh) 492ef0f32b
improved gemini index and atom 2021-05-02 10:32:40 +02:00
Yann Esposito (Yogsototh) 973f1c9936
makefile for build your website 2021-05-01 20:48:20 +02:00
Yann Esposito (Yogsototh) 69893ff61f
speed up deprecated work 2021-05-01 20:48:08 +02:00
Yann Esposito (Yogsototh) a22ec4e7ca
Improved CSS, fix typos 2021-05-01 15:33:59 +02:00
Yann Esposito (Yogsototh) 8210724925
index improved 2021-04-28 00:22:16 +02:00
Yann Esposito (Yogsototh) 7cbd8daac8
fix a pb with code indentation 2021-04-27 20:28:46 +02:00
Yann Esposito (Yogsototh) 0fcf693ff4
a few minor fixes 2021-04-27 19:38:24 +02:00
Yann Esposito (Yogsototh) 8944a17762
cleanup 2021-04-27 19:26:57 +02:00
Yann Esposito (Yogsototh) 14361d5289
I think it's good now 2021-04-27 15:32:55 +02:00
Yann Esposito (Yogsototh) 4ddc050e2c
a few fixes 2021-04-27 15:21:06 +02:00
Yann Esposito (Yogsototh) b0760a35cb
Almost complete 2021-04-27 15:06:55 +02:00
Yann Esposito (Yogsototh) f512d18a59
Almost done 2021-04-27 15:02:02 +02:00
Yann Esposito (Yogsototh) f89c62a6d4
makefile in progress 2021-04-27 14:34:29 +02:00
Yann Esposito (Yogsototh) b74e8e401a
wip 2021-04-26 22:53:10 +02:00
Yann Esposito (Yogsototh) 247c276788
slow but work 2021-04-18 23:21:53 +02:00
Yann Esposito (Yogsototh) 4b0d89488e
deploy on yannesposito.com 2021-04-18 17:40:32 +02:00
Yann Esposito (Yogsototh) 7f5758cd6e
support raw HTML and merged old blog 2021-04-18 12:23:24 +02:00
Yann Esposito (Yogsototh) e9f98fa5dc
build fix 2021-03-14 13:42:08 +01:00
Yann Esposito (Yogsototh) 00d04794d3
re-working 2021-03-13 23:41:34 +01:00
Yann Esposito (Yogsototh) 150d79f96b
use Computer Modern Unicode 2020-11-22 21:55:19 +01:00
Yann Esposito (Yogsototh) 83c6c3de8a
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2020-11-22 21:54:52 +01:00
Yann Esposito (Yogsototh) c5d591564e
Improved gemini gen added gemini link 2020-11-22 14:34:07 +01:00
Yann Esposito (Yogsototh) 5c376d9ef1
cv 2020-11-22 11:58:28 +01:00
Yann Esposito (Yogsototh) f1dc320648
try to fix PDF missing unicode char 2020-11-22 11:16:06 +01:00
Yann Esposito (Yogsototh) 5de898d7a2
removed archive 2020-11-22 10:31:04 +01:00
Yann Esposito (Yogsototh) d5a574ba0e
fix link in atom 2020-11-11 22:05:39 +01:00
Yann Esposito (Yogsototh) 90115c800d
Add gemini atomm 2020-11-11 22:00:31 +01:00
Yann Esposito (Yogsototh) 8bf91ba875
replace txt by gmi 2020-11-09 18:14:04 +01:00
Yann Esposito (Yogsototh) 67112b0974
improved hacky gemini script 2020-11-09 11:46:18 +01:00
Yann Esposito (Yogsototh) 3d0522192c
fix bug in hacky script 2020-11-09 11:37:32 +01:00
Yann Esposito (Yogsototh) 6c17127b22
use avenir, sans-serif by default 2020-11-09 11:31:20 +01:00
Yann Esposito (Yogsototh) 53f5125a04
gemini article 2020-11-09 11:31:08 +01:00
Yann Esposito (Yogsototh) bc3da59026
Generate gemini files along other resources 2020-11-09 10:52:51 +01:00
Yann Esposito (Yogsototh) e51b71685f
improved gemini gen script 2020-11-08 23:54:52 +01:00
Yann Esposito (Yogsototh) 301f394066
gemini archive file gen 2020-11-08 23:31:53 +01:00
Yann Esposito (Yogsototh) a394cb0165
improve slightly the gemini script 2020-11-08 22:19:03 +01:00
Yann Esposito (Yogsototh) 22e51c3564
quick and dirty org2gemini script 2020-11-08 21:38:58 +01:00
Yann Esposito (Yogsototh) 594434aa7b
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2020-11-08 18:17:19 +01:00
Yann Esposito (Yogsototh) c2be6d02de
Use markdown temporarily 2020-11-08 16:52:45 +01:00
Yann Esposito (Yogsototh) 3e7ac5dd4b
Generate gemini files 2020-11-08 16:25:55 +01:00
Yann Esposito (Yogsototh) 174fd595c3
Update dev script 2020-11-02 23:46:08 +01:00
Yann Esposito (Yogsototh) 196d3a1595
Slightly improved book theme. 2020-11-02 18:36:40 +01:00
Yann Esposito (Yogsototh) ddfec773bd
Added a book look&feel, import template 2020-11-02 14:28:35 +01:00
Yann Esposito (Yogsototh) 18eef9363e
fix optim breaking spaces 2020-11-02 11:46:15 +01:00
Yann Esposito (Yogsototh) 56a9afd6f7
back to css playground 2020-11-02 11:39:26 +01:00
Yann Esposito (Yogsototh) 480b87009c
Cleaner look, farther from minimalism 2020-11-02 01:25:11 +01:00
Yann Esposito (Yogsototh) bd2bf58fd9
improved css slightly 2020-11-01 23:44:02 +01:00
Yann Esposito (Yogsototh) c6cb39cb8a
new draft 2020-11-01 17:50:19 +01:00
Yann Esposito (Yogsototh) 3f60937599
Remove a warn 2020-10-29 19:08:17 +01:00
Yann Esposito (Yogsototh) 32da0b640d
fix a permalink related bug 2020-10-29 19:05:58 +01:00
Yann Esposito (Yogsototh) 2140b5fe0d
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2020-10-29 18:59:25 +01:00
Yann Esposito (Yogsototh) b37269f840
how I use org-mode 2020-10-29 09:54:07 +01:00
Yann Esposito (Yogsototh) 0032a6150d
Minor figcaption css tweak 2020-10-28 23:23:34 +01:00
Yann Esposito (Yogsototh) 0b1a9c46dd
updated 2020-10-28 23:19:20 +01:00
Yann Esposito (Yogsototh) 0e0f00f9d6
Fix & improve old posts 2020-10-20 21:30:38 +02:00
Yann Esposito (Yogsototh) 0e9325403b
update 2020-10-16 12:33:10 +02:00
Yann Esposito (Yogsototh) d61aa3284d
fix a bug 2020-10-03 12:18:13 +02:00
Yann Esposito (Yogsototh) febb698244
/Users/esposito/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-28 11:51:31 +02:00
Yann Esposito (Yogsototh) 91db9b9db8
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-26 13:59:15 +02:00
Yann Esposito (Yogsototh) 34bf9ca489
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-26 13:54:57 +02:00
Yann Esposito (Yogsototh) ce2c11b474
Better screenshots 2020-09-26 13:51:19 +02:00
Yann Esposito (Yogsototh) 11498ebb8e
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:42:10 +02:00
Yann Esposito (Yogsototh) 1311a875c1
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:39:38 +02:00
Yann Esposito (Yogsototh) b794dcb6c4
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:36:21 +02:00
Yann Esposito (Yogsototh) 78056f8420
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:30:44 +02:00
Yann Esposito (Yogsototh) bcd25fb698
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:27:55 +02:00
Yann Esposito (Yogsototh) d2fbe18fcb
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:26:25 +02:00
Yann Esposito (Yogsototh) 087691b634
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:25:06 +02:00
Yann Esposito (Yogsototh) 445943f98e
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:23:02 +02:00
Yann Esposito (Yogsototh) 819272c958
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:18:50 +02:00
Yann Esposito (Yogsototh) a870303671
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:17:36 +02:00
Yann Esposito (Yogsototh) 90cb9fc7aa
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:15:35 +02:00
Yann Esposito (Yogsototh) a9f8a06c84
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:13:53 +02:00
Yann Esposito (Yogsototh) 75c3f17b0a
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:12:03 +02:00
Yann Esposito (Yogsototh) 198517e6ba
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:10:29 +02:00
Yann Esposito (Yogsototh) cdb90f7be6
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:09:00 +02:00
Yann Esposito (Yogsototh) 91d69284e3
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:05:45 +02:00
Yann Esposito (Yogsototh) 61940312b9
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:04:24 +02:00
Yann Esposito (Yogsototh) 582424dde8
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 08:02:52 +02:00
Yann Esposito (Yogsototh) a7a69ee67f
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:59:45 +02:00
Yann Esposito (Yogsototh) acb0ab6cac
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:58:39 +02:00
Yann Esposito (Yogsototh) 7147b85e19
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:57:37 +02:00
Yann Esposito (Yogsototh) 4c8402c4d0
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:56:27 +02:00
Yann Esposito (Yogsototh) 0a260ac99f
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:55:08 +02:00
Yann Esposito (Yogsototh) 1807b1e8b8
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:54:04 +02:00
Yann Esposito (Yogsototh) 259e7deb3e
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:52:58 +02:00
Yann Esposito (Yogsototh) deea3ea5a3
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:50:07 +02:00
Yann Esposito (Yogsototh) 6dc7c428b0
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:48:05 +02:00
Yann Esposito (Yogsototh) 5e60ed6e82
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:45:54 +02:00
Yann Esposito (Yogsototh) a72501031e
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:38:52 +02:00
Yann Esposito (Yogsototh) 7c2eab1087
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:36:37 +02:00
Yann Esposito (Yogsototh) ce944d7ee7
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:35:18 +02:00
Yann Esposito (Yogsototh) 69eecec678
/Users/yaesposi/y/her.esy.fun/src/drafts/XXXX-org-mode-intro/index.org 2020-09-23 07:34:15 +02:00
Yann Esposito (Yogsototh) fdf913240e
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:21:22 +02:00
Yann Esposito (Yogsototh) db11134536
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:14:37 +02:00
Yann Esposito (Yogsototh) eb546befc5
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:13:16 +02:00
Yann Esposito (Yogsototh) da1f2bf629
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:11:14 +02:00
Yann Esposito (Yogsototh) fa9cf38fcb
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:04:33 +02:00
Yann Esposito (Yogsototh) 03814d033f
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 08:01:18 +02:00
Yann Esposito (Yogsototh) 70fdb740c5
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:59:14 +02:00
Yann Esposito (Yogsototh) a702bee433
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:57:55 +02:00
Yann Esposito (Yogsototh) 4ce8b8193e
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:54:54 +02:00
Yann Esposito (Yogsototh) 8a9d30d0af
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:50:29 +02:00
Yann Esposito (Yogsototh) 2f0e4b974a
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:49:13 +02:00
Yann Esposito (Yogsototh) c4689a0528
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:46:50 +02:00
Yann Esposito (Yogsototh) 64b11f9245
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:44:37 +02:00
Yann Esposito (Yogsototh) 2198de65af
/Users/yaesposi/y/her.esy.fun/src/posts/0014-change-emacs-theme-automatically/index.org 2020-09-22 07:43:23 +02:00
Yann Esposito (Yogsototh) 1b5bafcb24
Update article a bit 2020-09-21 13:30:30 +02:00
Yann Esposito (Yogsototh) 9ab13c0548
updated to use screenshots 2020-09-20 13:20:39 +02:00
Yann Esposito (Yogsototh) 2d8c04894d
Finally added TOC generation 2020-08-23 14:06:08 +02:00
Yann Esposito (Yogsototh) 15e6289220
Fix footer of slides 2020-08-22 23:26:52 +02:00
Yann Esposito (Yogsototh) 0ab3c221a9
Fix slides style 2020-08-22 23:17:41 +02:00
Yann Esposito (Yogsototh) 973f347eef
Sill some tweaks 2020-08-22 19:32:12 +02:00
Yann Esposito (Yogsototh) fecd03b370
geekier css 2020-08-22 12:47:04 +02:00
Yann Esposito (Yogsototh) ffa36b27d5
Improve slightly css 2020-08-20 22:55:45 +02:00
Yann Esposito (Yogsototh) 5ae19b34eb
cleanup style 2020-08-08 11:19:34 +02:00
Yann Esposito (Yogsototh) 3fe423322c
improvements, simplifications 2020-08-06 10:29:34 +02:00
Yann Esposito (Yogsototh) a6a4910acf
Updates, added pdf. 2020-06-27 15:49:25 +02:00
Yann Esposito (Yogsototh) 9ddc693b3a
New system in place 2020-06-27 14:57:04 +02:00
Yann Esposito (Yogsototh) eff4b0bbf6
remove js entirely 2020-06-27 14:25:53 +02:00
Yann Esposito (Yogsototh) 8ebe8bed51
Merge branch 'shake' 2020-06-25 18:43:33 +02:00
Yann Esposito (Yogsototh) 53fa733209
minor fix 2020-06-25 17:42:33 +02:00
Yann Esposito (Yogsototh) 78008d3df4
fixed almos everything 2020-06-25 17:23:59 +02:00
Yann Esposito (Yogsototh) 6c3f4f3031
updated and mostly feature equal 2020-06-25 16:28:35 +02:00
Yann Esposito (Yogsototh) f12936254a
better templates 2020-06-25 15:27:00 +02:00
Yann Esposito (Yogsototh) 931d9c4483
improvements 2020-06-25 14:22:58 +02:00
Yann Esposito (Yogsototh) 62461dc616
update 2020-06-25 13:08:18 +02:00
Yann Esposito (Yogsototh) 4df922b475
fix archive build 2020-06-25 07:10:00 +02:00
Yann Esposito (Yogsototh) c34fa83504
Neil Mitchell help https://github.com/ndmitchell/shake/issues/767 2020-06-25 07:06:16 +02:00
Yann Esposito (Yogsototh) 0a1aef7425
archive working, site working 2020-06-24 18:36:56 +02:00
Yann Esposito (Yogsototh) 0e44c7d427
right track 2020-06-23 23:58:09 +02:00
Yann Esposito (Yogsototh) 4b8a5d3c89
Merge branch 'shake' of gitea.esy.fun:yogsototh/her.esy.fun into shake 2020-06-23 19:29:20 +02:00
Yann Esposito (Yogsototh) aef6f81274
Fixes 2020-06-23 19:28:41 +02:00
Yann Esposito (Yogsototh) 3a13435710
updated with niv 2020-06-23 16:55:38 +02:00
Yann Esposito (Yogsototh) d47ad32074
updated hlint 2020-06-23 16:14:53 +02:00
Yann Esposito (Yogsototh) 2bdc881cc9
closer 2020-06-23 09:15:03 +02:00
Yann Esposito (Yogsototh) d201cf8b1b
wip 2020-06-23 08:44:02 +02:00
Yann Esposito (Yogsototh) c1a00e1c09
closer 2020-06-23 00:20:38 +02:00
Yann Esposito (Yogsototh) e5d9673fc4
right track 2020-06-22 23:01:47 +02:00
Yann Esposito (Yogsototh) f3be772986
mostly works 2020-06-22 22:13:12 +02:00
Yann Esposito (Yogsototh) a706933d96
remove ignored files 2020-06-22 14:32:03 +02:00
Yann Esposito (Yogsototh) 5359765bf5
updated 2020-06-22 12:27:55 +02:00
Yann Esposito (Yogsototh) b81339a51e
progress 2020-06-22 12:08:07 +02:00
Yann Esposito (Yogsototh) e3a33d9ecf
starting to work 2020-06-22 11:44:11 +02:00
Yann Esposito (Yogsototh) 2585645555
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2020-06-22 10:40:40 +02:00
Yann Esposito (Yogsototh) 1eb4a6de5a
save 2020-06-22 09:39:44 +02:00
Yann Esposito (Yogsototh) 1e0d4c8fad
forgot some gitignore 2020-06-21 15:52:33 +02:00
Yann Esposito (Yogsototh) fcd406a3d9
Merge branch 'master' into shake 2020-06-21 15:50:53 +02:00
Yann Esposito (Yogsototh) d6223ad3d4
minor css fix 2020-06-20 19:52:08 +02:00
Yann Esposito (Yogsototh) 05314b7001
update for the new blog post. 2020-06-17 00:10:49 +02:00
Yann Esposito (Yogsototh) e3f7c5c0bd
wip 2020-06-15 00:45:51 +02:00
Yann Esposito (Yogsototh) 9eb7ecb8ef
save 2020-06-15 00:02:26 +02:00
Yann Esposito (Yogsototh) 35f24f831d
updated colors and CSS 2020-06-14 23:52:09 +02:00
Yann Esposito (Yogsototh) ec94f39e93
upgrade 2020-06-14 16:16:23 +02:00
Yann Esposito (Yogsototh) 536f0ed5e6
wip 2020-06-14 13:19:13 +02:00
Yann Esposito (Yogsototh) 054a90bc87
removed keybase reference 2020-06-12 10:22:16 +02:00
Yann Esposito (Yogsototh) 0f62b038df
minor fixes 2020-05-25 22:30:22 +02:00
Yann Esposito (Yogsototh) a7df9b3959
move to shake 2020-05-25 22:28:06 +02:00
Yann Esposito (Yogsototh) 84bdac8e87
fix light/dark theme switch 2020-05-25 01:39:31 +02:00
Yann Esposito (Yogsototh) 53e70c33c7
more pixelartsy and fix toc numbering 2020-05-25 01:30:48 +02:00
Yann Esposito (Yogsototh) 18406ffbb6
Added computer modern fonts, but I do not use them. 2020-05-24 13:37:21 +02:00
Yann Esposito (Yogsototh) eefd8e1210
use lorri for envrc, faster better 2020-05-21 18:33:34 +02:00
Yann Esposito (Yogsototh) 4ebfda2215
Add alt attribute 2020-05-12 23:46:10 +02:00
Yann Esposito (Yogsototh) 9a2b08fdaa
Theme selector re-added & improved. 2020-05-11 22:51:19 +02:00
Yann Esposito (Yogsototh) 78543503ae
line-heigh fix 2020-05-11 00:26:46 +02:00
Yann Esposito (Yogsototh) 958a7f0c36
dark mode back, no switch 2020-05-11 00:15:59 +02:00
Yann Esposito (Yogsototh) 239a080f7a
retro colors 2020-05-10 22:13:53 +02:00
Yann Esposito (Yogsototh) f5b21e0b9a
geekier look, monospace 2020-05-10 20:39:01 +02:00
Yann Esposito (Yogsototh) f3817fc6b6
Fix footnote bug 2020-05-09 14:52:32 +02:00
Yann Esposito (Yogsototh) 91e6c2c5d8
updated site and added a new post 2020-05-09 14:40:59 +02:00
Yann Esposito (Yogsototh) 6ae31cc7fa
Merge branch 'master' of gitea.esy.fun:yogsototh/her.esy.fun 2020-05-09 12:18:18 +02:00
Yann Esposito (Yogsototh) cdcb7a5a55
Renamed 2020-05-09 12:15:46 +02:00
Yann Esposito (Yogsototh) b720452dbc
update 2020-05-09 00:20:44 +02:00
Yann Esposito (Yogsototh) 34955e0ca4
wip 2020-05-08 17:58:10 +02:00
Yann Esposito (Yogsototh) d070bed128
modern looking 2020-05-04 10:49:00 +02:00
Yann Esposito (Yogsototh) 175612b82f
add gzip size 2020-05-03 21:50:56 +02:00
Yann Esposito (Yogsototh) bae4ce7967
removed blur on image, it was awful 2020-05-03 14:39:17 +02:00
Yann Esposito (Yogsototh) 66ef4fab7b
fix compress script 2020-05-03 14:32:00 +02:00
Yann Esposito (Yogsototh) 43492d5f8d
Cleanup code and fixed dates 2020-05-03 14:15:35 +02:00
Yann Esposito (Yogsototh) 327bc89991
retro-incompatible naming convention 2020-05-03 13:47:38 +02:00
Yann Esposito (Yogsototh) f7c5c97a3b
naming convention enforced 2020-05-03 13:43:04 +02:00
Yann Esposito (Yogsototh) 4bac995a5a
Update css for label on top of pre. 2020-05-02 19:43:19 +02:00
Yann Esposito (Yogsototh) 3c7d427832
do not launch emacs GUI during build 2020-05-02 19:36:53 +02:00
Yann Esposito (Yogsototh) fabd670b4c
Fixed solaryzed article, minor css change 2020-05-02 19:31:18 +02:00
Yann Esposito (Yogsototh) 67ee9e162e
remove description for about me 2020-05-02 15:33:15 +02:00
Yann Esposito (Yogsototh) 367de29ccd
Add descriptions. 2020-05-02 15:30:40 +02:00
Yann Esposito (Yogsototh) ae8c3a1954
updated a bit to add description text. 2020-05-02 13:37:25 +02:00
Yann Esposito (Yogsototh) 0f054b8b8a
Use comment by email, relative links, cleaner footer 2020-05-02 12:03:04 +02:00
Yann Esposito (Yogsototh) 25010b68c1
Update look&feel, count, simplify 2020-05-01 19:26:07 +02:00
Yann Esposito (Yogsototh) 71c6f95ce5
update footer, simpler css 2020-05-01 15:25:59 +02:00
Yann Esposito (Yogsototh) 8d398cb862
minor typo fix and use orange 2020-05-01 10:59:34 +02:00
Yann Esposito (Yogsototh) b7726810d2
add cacert 2020-05-01 10:32:32 +02:00
Yann Esposito (Yogsototh) d5b394278a
Add logo 2020-05-01 10:27:39 +02:00
Yann Esposito (Yogsototh) 1962c6414d
add source link 2020-04-25 12:41:37 +02:00
Yann Esposito (Yogsototh) d6b824d3f9
Remove theme switching 2020-04-25 12:13:21 +02:00
Yann Esposito (Yogsototh) b464a131b3
cleaner theme 2020-04-25 12:11:07 +02:00
Yann Esposito (Yogsototh) 90f21e44ce
update css 2020-04-18 23:07:50 +02:00
Yann Esposito (Yogsototh) a7e818460f
fixed clean find command, removed Nerdy in the homepage list 2020-04-18 10:58:18 +02:00
Yann Esposito (Yogsototh) a3a2bb0c22
fixed the menu 2020-04-18 10:48:53 +02:00
Yann Esposito (Yogsototh) 9993d3090c
update gitignores 2020-04-11 17:42:04 +02:00
Yann Esposito (Yogsototh) d817cc3675
cleaner init/clean 2020-04-11 14:29:35 +02:00
Yann Esposito (Yogsototh) db338f601b
faster cached nix direnv 2020-04-11 14:17:10 +02:00
Yann Esposito (Yogsototh) a5a5fac224
Slightly more colorful 2020-04-10 04:41:57 +02:00
Yann Esposito (Yogsototh) cf6c664913
fix typo 2020-03-10 00:01:12 +01:00
Yann Esposito (Yogsototh) e013898f2f
Used writegood suggestions 2020-03-09 23:55:55 +01:00
Yann Esposito (Yogsototh) 5758c55904
a few fixes 2020-03-02 00:29:20 +01:00
Yann Esposito (Yogsototh) cde994ce15
Added an idea in the todos 2020-03-02 00:21:56 +01:00
Yann Esposito (Yogsototh) 2128b6328d
published solaryzed 2020-03-02 00:19:29 +01:00
Yann Esposito (Yogsototh) a89eece4c9
optim is a bit better 2020-02-29 18:19:00 +01:00
Yann Esposito (Yogsototh) d938e25503
add tangle to code block 2020-02-29 17:08:05 +01:00
Yann Esposito (Yogsototh) daf28b0bba
fix css 2020-02-29 16:53:40 +01:00
Yann Esposito (Yogsototh) e8eaa51371
tangle displayed correctly 2020-02-29 16:46:07 +01:00
Yann Esposito (Yogsototh) 23b4c0a4f3
🚧 WIP 🚧 2020-02-29 01:06:00 +01:00
Yann Esposito (Yogsototh) 11d58b18ac
env and toto update 2020-02-27 14:19:32 +01:00
Yann Esposito (Yogsototh) 3a163d03a7
Better palette, logic of solaryzed is wrong somewhere 2020-02-22 21:11:18 +00:00
Yann Esposito (Yogsototh) a0b8eab744
still css fixes 2020-02-22 20:52:52 +00:00
Yann Esposito (Yogsototh) 3ed0ede1ce
fix a bug in project.el 2020-02-22 20:24:27 +00:00
Yann Esposito (Yogsototh) 06be22d92c
mess a bit with the CSS 2020-02-22 17:11:49 +00:00
Yann Esposito (Yogsototh) fa7911f91f
fix menu, added a few direct links 2020-02-21 10:27:51 +00:00
Yann Esposito (Yogsototh) 457b084efe
Default light theme 2020-02-17 17:56:36 +01:00
Yann Esposito (Yogsototh) e0fda04f33
still playing with css 2020-02-16 19:33:40 +01:00
Yann Esposito (Yogsototh) f0913204b9
Wrong font commited while playing 2020-02-16 19:21:13 +01:00
Yann Esposito (Yogsototh) 6e7faf916c
Minor CSS fixes 2020-02-16 19:09:59 +01:00
Yann Esposito (Yogsototh) ab8faf354c
css cleanup and enhancement 2020-02-16 17:34:31 +01:00
Yann Esposito (Yogsototh) 717269a4bb
updated slightly engine 2020-02-16 16:56:19 +01:00
Yann Esposito (Yogsototh) d426186477
add % to logs 2020-02-16 15:49:12 +01:00
Yann Esposito (Yogsototh) 60908a1f64
sign project 2020-02-16 15:42:33 +01:00
Yann Esposito (Yogsototh) fc5b367863
minimal fixes. 2020-02-16 15:41:44 +01:00
Yann Esposito (Yogsototh) cbca678ce1
0011 not ready yet 2020-02-16 15:34:53 +01:00
Yann Esposito (Yogsototh) af6b7ff280
Fix some text. 2020-02-16 15:32:33 +01:00
Yann Esposito (Yogsototh) 23e166a56c
improve legibility 2020-02-16 11:48:16 +01:00
Yann Esposito (Yogsototh) fb11b23fec
remove themes 2020-02-13 00:39:46 +01:00
Yann Esposito (Yogsototh) 1526d468ee
a bit of magic 2020-02-12 17:53:53 +01:00
Yann Esposito (Yogsototh) a0e129008c
Merge branch 'haskell-project' of gitea.esy.fun:yogsototh/her.esy.fun into haskell-project 2020-02-11 22:12:40 +01:00
Yann Esposito (Yogsototh) 8c85033f8f
Initial plan for 0011 2020-02-11 22:11:38 +01:00
Yann Esposito (Yogsototh) e232af794c
minor css changes 2020-02-10 18:51:45 +01:00
Yann Esposito (Yogsototh) adda573e72
a bit of shellcheck 2020-02-10 09:42:17 +01:00
Yann Esposito (Yogsototh) 73c6c68d92
updated scripts 2020-02-09 13:24:53 +01:00
Yann Esposito (Yogsototh) fe98c7dd13
script move 2020-02-09 12:57:46 +01:00
Yann Esposito (Yogsototh) 5b13f77fe1
cleaner nix file 2020-02-03 10:10:41 +01:00
Yann Esposito (Yogsototh) f48fc2c18c
Haskell project summoner nix 2020-02-02 16:06:07 +01:00
Yann Esposito (Yogsototh) a56725d09f
Started a new draft 2020-01-18 16:24:37 +01:00
Yann Esposito (Yogsototh) 3d79f20371
comment from Reynaldo Cordero about PS1 in nix-shell 2020-01-10 12:21:33 +01:00
Yann Esposito (Yogsototh) 9e1cbf9e52
fix a few bugs 2020-01-04 15:29:27 +01:00
Yann Esposito (Yogsototh) a19d95a38c
Merge branch 'master' of gitlab.esy.fun:yogsototh/her.esy.fun 2020-01-04 00:06:46 +01:00
Yann Esposito (Yogsototh) fe9bc35b88
Fix (>>>) instead of (&) for Haskell Now! 2020-01-03 19:36:22 +01:00
Yann Esposito (Yogsototh) bd111cf45c
Updated, removed projects sections. 2020-01-03 09:34:31 +01:00
Yann Esposito (Yogsototh) f95b37c771
A few changes to the project 2020-01-03 08:21:17 +01:00
Yann Esposito (Yogsototh) f8586974b6
first pass 2020-01-01 23:54:53 +01:00
Yann Esposito (Yogsototh) e24de08c34
Nix introduction 2019-12-31 01:00:04 +01:00
Yann Esposito (Yogsototh) 0d1e4ff2a3
added project with nix 2019-12-30 21:47:22 +01:00
Yann Esposito (Yogsototh) c65b820e0a
Tryed to add more insight for Haskell types. 2019-12-27 11:30:08 +01:00
Yann Esposito (Yogsototh) 3f403f946b
Progress 2019-12-26 17:27:19 +01:00
Yann Esposito (Yogsototh) 250335f16b
progress 2019-12-26 12:45:11 +01:00
Yann Esposito (Yogsototh) cc7ee03907
wip 2019-12-25 22:17:22 +01:00
Yann Esposito (Yogsototh) 7784f02483
wip 2019-12-25 16:35:56 +01:00
Yann Esposito (Yogsototh) 383b69bc75
Sentence split. 2019-12-24 01:23:05 +01:00
Yann Esposito (Yogsototh) f64df8ca10
Better nix-shell, discard stack 2019-12-23 10:56:47 +01:00
Yann Esposito (Yogsototh) b39ae4e00a
nix-shell 2019-12-23 02:08:11 +01:00
Yann Esposito (Yogsototh) 5be92b888d wip 2019-12-23 00:01:06 +01:00
Yann Esposito (Yogsototh) c9965904a0
cleanup 2019-12-16 15:27:31 +01:00
Yann Esposito (Yogsototh) e7015adbb0
minor progress around code source 2019-12-16 13:07:02 +01:00
Yann Esposito (Yogsototh) 775d4d616f
wip 2019-12-15 17:05:57 +01:00
Yann Esposito (Yogsototh) 94632f8135
Added images, fixed syntax highlighting 2019-12-15 13:03:35 +01:00
Yann Esposito (Yogsototh) f76b208dd9
added haskell the hard way, still work to do 2019-12-15 01:34:58 +01:00
Yann Esposito (Yogsototh) 24c7f8b9c4
logo fix, minor hrule fix too 2019-12-08 16:00:31 +01:00
Yann Esposito (Yogsototh) 152c47b862
fix slide bug, ouline depth is used 2019-12-07 00:58:57 +01:00
Yann Esposito (Yogsototh) a91429822c
typo 2019-12-06 19:14:53 +01:00
Yann Esposito (Yogsototh) 3863238050
updated with a few numbers 2019-12-06 19:05:06 +01:00
Yann Esposito (Yogsototh) 5bbd170638
enhanced optim-classes script 2019-12-06 15:34:36 +01:00
Yann Esposito (Yogsototh) 5435e583eb
slightly safer script 2019-12-05 17:17:31 +01:00
Yann Esposito (Yogsototh) 993d61a114
optim classes done 2019-12-05 17:07:57 +01:00
Yann Esposito (Yogsototh) 5a534922eb
optim WIP 2019-12-05 14:55:51 +01:00
Yann Esposito (Yogsototh) 7bab6d0b3e
added latest blog post 2019-12-03 11:00:00 +01:00
Yann Esposito (Yogsototh) bd11b5d3a4
Start a new blog post about my blog, yes a new meta :) 2019-11-30 15:04:40 +01:00
Yann Esposito (Yogsototh) 57f3526340
another minor css fix 2019-11-29 17:14:11 +01:00
Yann Esposito (Yogsototh) 6ce2e809fe
fixed modern css 2019-11-29 17:11:24 +01:00
Yann Esposito (Yogsototh) 1499ad8877
improved duplication script 2019-11-28 19:00:22 +01:00
Yann Esposito (Yogsototh) e3e3c3d909
Updated the CSS themes 2019-11-28 17:56:57 +01:00
Yann Esposito (Yogsototh) 8a949239ae
css work 2019-11-28 00:28:10 +01:00
Yann Esposito (Yogsototh) 19e60630ae
optim html, minor changes 2019-11-27 19:06:42 +01:00
Yann Esposito (Yogsototh) d330c8688d
updated CSS and style 2019-11-27 17:07:25 +01:00
Yann Esposito (Yogsototh) 607fc7c892
WIP 2019-11-23 01:02:42 +08:00
Yann Esposito (Yogsototh) 5eef7c25a0
duplicate for theme, improve size 2019-11-22 11:23:04 +08:00
Yann Esposito (Yogsototh) 96d70cee80
Logo include + minor CSS changes 2019-11-22 09:55:20 +08:00
Yann Esposito (Yogsototh) 1a9dc319b5
use svg for about-me 2019-11-22 08:51:02 +08:00
Yann Esposito (Yogsototh) 44698c6f39
Fix a minor css mistake 2019-11-22 08:46:03 +08:00
Yann Esposito (Yogsototh) 59b68747ca
better img compression and css 2019-11-22 08:42:48 +08:00
Yann Esposito (Yogsototh) 6e53c77236
Remove ToC for catalina 2019-11-21 23:21:15 +08:00
Yann Esposito (Yogsototh) 7643502734
cleaner css 2019-11-21 23:19:06 +08:00
Yann Esposito (Yogsototh) 361b27d196
Cleaner ToC CSS, certainly need to fix for #modern-theme 2019-11-21 17:24:11 +08:00
Yann Esposito (Yogsototh) bbe8cf6891
slightly more CSS upgrades 2019-11-19 23:18:41 +08:00
Yann Esposito (Yogsototh) 2e26792403
Improve file size 2019-11-19 22:14:20 +08:00
Yann Esposito (Yogsototh) 9212e104f6
slightly smaller pages 2019-11-19 11:56:12 +08:00
Yann Esposito (Yogsototh) 2b652d16f0
first pass minifier 2019-11-18 16:46:15 +08:00
Yann Esposito (Yogsototh) 90c072ab8c
add file size 2019-11-13 00:36:17 +01:00
Yann Esposito (Yogsototh) 32ab26c448
Fixes for css too. 2019-11-11 01:05:52 +01:00
Yann Esposito (Yogsototh) b132ed3ce1
iTerm profile switch 2019-11-10 22:15:00 +01:00
Yann Esposito (Yogsototh) 2b90505d7b
iTerm profile switch 2019-11-10 22:05:12 +01:00
Yann Esposito (Yogsototh) fc7620a327
typos 2019-11-05 10:29:34 +01:00
Yann Esposito (Yogsototh) 88af2f0be6
minor styles corrections 2019-11-05 10:24:21 +01:00
Yann Esposito (Yogsototh) 32c32d4003
remove comment 2019-11-05 09:51:45 +01:00
Yann Esposito (Yogsototh) e06d3eeb9f
better css 2019-11-05 09:51:18 +01:00
Yann Esposito (Yogsototh) 1d21a151a5
added syntax highlighting for nix 2019-11-04 09:27:53 +01:00
Yann Esposito (Yogsototh) 3033318868
minor style fix 2019-11-04 09:14:45 +01:00
Yann Esposito (Yogsototh) 720e2a8c63
Merge branch 'master' of gitlab.esy.fun:yogsototh/her.esy.fun 2019-11-04 09:05:28 +01:00
Yann Esposito (Yogsototh) 5461f37300
fix syntax highlighting correctly 2019-11-04 09:03:38 +01:00
Yann Esposito (Yogsototh) 54f94c9137
fix some typos 2019-11-04 08:31:59 +01:00
Yann Esposito (Yogsototh) 108f5d1542
cleaned files 2019-10-29 09:17:14 +01:00
Yann Esposito (Yogsototh) 449b777380
updated to latest solaryzed theme choice 2019-10-23 21:02:55 +02:00
Yann Esposito (Yogsototh) 380c1a38f1
Merge branch 'irc-2019' 2019-10-23 20:47:58 +02:00
Yann Esposito (Yogsototh) 7622bd555a
compress CSS 2019-10-20 21:56:27 +02:00
Yann Esposito (Yogsototh) 060fa9fa2a
updated slightly the article 2019-10-20 19:07:36 +02:00
Yann Esposito (Yogsototh) e46dad20b9
added screenshots, cleaned up 2019-10-20 13:44:42 +02:00
Yann Esposito (Yogsototh) ec4bf3564e
Bigger font in the CSS
- grey, less colors
2019-10-19 23:27:54 +02:00
Yann Esposito (Yogsototh) 776c87a019
Updated file position, CSS with nord 2019-10-19 22:37:25 +02:00
Yann Esposito (Yogsototh) 91c850b7fe
Updated text a bit 2019-10-19 19:13:18 +02:00
Yann Esposito (Yogsototh) 6adfe0ba7d
Finalised and use tangle for some source code 2019-10-19 16:36:14 +02:00
Yann Esposito (Yogsototh) 55fc8ebef5
Started the tutorial 2019-10-16 17:03:04 +02:00
Yann Esposito (Yogsototh) ae4251f2d9
digression :) 2019-10-16 14:26:26 +02:00
Yann Esposito (Yogsototh) 1f7d79ba06
Update a bit the intro. 2019-10-15 21:26:47 +02:00
Yann Esposito (Yogsototh) ca0a191d30
Short addition 2019-10-12 16:09:41 +02:00
Yann Esposito (Yogsototh) 229beaaf57
:wip: 2019-10-07 17:54:11 +02:00
Yann Esposito (Yogsototh) 058a1b1ae7
add shell.nix in documents 2019-10-04 21:42:55 +02:00
Yann Esposito (Yogsototh) f5e1b1f991
🚧 WIP 🚧 2019-10-04 21:41:42 +02:00
Yann Esposito (Yogsototh) 4db6bae65a
updated RSS gen again with absolut path made it fully valid 2019-10-01 07:44:03 +02:00
Yann Esposito (Yogsototh) 85de18b02b
updated nix-shell and link to mkrss.sh 2019-09-30 21:14:36 +02:00
Yann Esposito (Yogsototh) 277358c2b5
fix mkrss file path 2019-09-30 21:01:46 +02:00
Yann Esposito (Yogsototh) 8abeacb211
fix ignore files 2019-09-30 20:58:31 +02:00
Yann Esposito (Yogsototh) 57f3b4e77f
ignore archive.org file 2019-09-30 20:54:37 +02:00
Yann Esposito (Yogsototh) 526a8f9db0
Added RSS gen article 2019-09-30 15:54:43 +02:00
Yann Esposito (Yogsototh) 22a2d2bd6c
Improved RSS generation 2019-09-30 15:10:39 +02:00
Yann Esposito (Yogsototh) 29d1945cc0
Add categories to RSS 2019-09-30 09:54:53 +02:00
Yann Esposito (Yogsototh) 54d2c30ef2
small fixes 2019-09-27 16:43:43 +02:00
Yann Esposito (Yogsototh) 7f0d446b25
missing word :( 2019-09-27 15:55:58 +02:00
Yann Esposito 7dfb48c4aa Merge branch 'typos-how-i-internet' into 'master'
typos

See merge request yogsototh/her.esy.fun!1
2019-09-26 14:26:18 +00:00
Guillaume ERETEO a10fe0e178
typos 2019-09-26 12:54:35 +02:00
Yann Esposito (Yogsototh) e6b38dd1e3
updated a few scripts 2019-09-25 16:31:47 +02:00
Yann Esposito (Yogsototh) d2c26615d8
RSS builder fix, proof read, minor CSS improvements 2019-09-25 15:36:52 +02:00
Yann Esposito (Yogsototh) e229deb765
update 2019-09-25 12:11:24 +02:00
Yann Esposito (Yogsototh) db10d72dea
Update 2019-09-25 10:36:09 +02:00
Yann Esposito (Yogsototh) 99ff3eee87
removed RSS from org 2019-09-24 17:59:09 +02:00
Yann Esposito (Yogsototh) 31fe5a7bb4
added REAL RSS generator 2019-09-24 17:55:59 +02:00
Yann Esposito (Yogsototh) 7a2fc5971c
use radio button again to fix anchor link issue 2019-09-23 10:01:34 +02:00
Yann Esposito (Yogsototh) 347fba0d34
How I Internet, need to proof read 2019-09-20 15:05:56 +02:00
Yann Esposito (Yogsototh) e48a30d12f
Updated blog, css, etc.. 2019-09-19 23:36:20 +02:00
Yann Esposito (Yogsototh) 3f37793ee6
Smal comment added 2019-09-16 11:44:50 +02:00
Yann Esposito (Yogsototh) 2d18bb2cd3
WIP How I Internet 2019-09-16 11:42:49 +02:00
Yann Esposito (Yogsototh) 0082064358
enhanced archive and rss 2019-09-12 14:41:53 +02:00
Yann Esposito (Yogsototh) 3d5534e6d7
Updated slightly modern CSS 2019-09-06 12:18:42 +02:00
Yann Esposito (Yogsototh) 6b08d09fa8
fix html for css 2019-09-01 23:27:15 +02:00
Yann Esposito (Yogsototh) a68d8fdd3f
rss fix 2019-09-01 23:12:03 +02:00
Yann Esposito (Yogsototh) ae584b4f8f
fixed rss, made it faster, but less awesome 2019-09-01 23:03:24 +02:00
783 changed files with 100536 additions and 2091 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
eval "$(lorri direnv)"

9
.gitignore vendored
View file

@ -1,5 +1,4 @@
_cache
_site
src/posts/rss.org
src/posts/index.org
src/micro/rss.org
.cache/
_site/
.direnv/
engine/envvars.sh

63
.hlint.yaml Normal file
View file

@ -0,0 +1,63 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}
# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml
# Protolude does not use String and prefer Text so String is undefined and we should use [Char]
- ignore: {name: Use String}

196
Makefile Normal file
View file

@ -0,0 +1,196 @@
# Generate my website out of org-mode/gemini files
all: site
SRC_DIR ?= src
DST_DIR ?= _site
CACHE_DIR ?= .cache
# we don't want to publish files in drafts
NO_DRAFT := -not -path '$(SRC_DIR)/drafts/*'
# we don't copy source files
NO_SRC_FILE := ! -name '*.org' ! -name '*.css'
define adv_rule
SRC_$(1) := $$(shell find $$(SRC_DIR) -type f $(2))
DST_$(1) := $$(patsubst $$(SRC_DIR)/%,$$(DST_DIR)/%,$$(SRC_$(1)))
$$(DST_DIR)/%$(4): $$(SRC_DIR)/%$(4) $$(ENV_VARS)
@mkdir -p "$$(dir $$@)"
$(3)
.PHONY: $(1)
$(1): $$(DST_$(1))
ALL += $(1)
endef
define rule
SRC_$(1) := $$(shell find $$(SRC_DIR) -type f $(2))
DST_$(1) := $$(patsubst $$(SRC_DIR)/%,$$(DST_DIR)/%,$$(SRC_$(1)))
$$(DST_DIR)/%.$(1): $$(SRC_DIR)/%.$(1) $$(ENV_VARS)
@mkdir -p "$$(dir $$@)"
$(3)
.PHONY: $(1)
$(1): $$(DST_$(1))
ALL += $(1)
endef
# Prevent path/nix bugs
ENV_VARS := ./engine/envvars.sh
NIX_FILES := ./shell.nix $(shell find nix -type f)
$(ENV_VARS): $(NIX_FILES)
$(info Build ${ENV_VARS})
@echo "export PATH=\"${PATH}\"" >> ./engine/envvars.sh
.PHONY: envvars
envvars: $(ENV_VARS)
ALL += envvars
# ASSETS
$(eval $(call adv_rule,assets,$$(NO_DRAFT) $$(NO_SRC_FILE),cp "$$<" "$$@",))
# CSS
# $(info $(call rule,css,-name '*.css',minify "$$<" > "$$@"))
$(eval $(call rule,css,-name '*.css',minify "$$<" > "$$@"))
# ORG -> HTML
EXT ?= .org
SRC_PANDOC_FILES ?= $(shell find $(SRC_DIR) -type f -name "*$(EXT)" $(NO_DRAFT))
DST_PANDOC_FILES ?= $(patsubst %$(EXT),%.html, \
$(patsubst $(SRC_DIR)/%,$(DST_DIR)/%, \
$(SRC_PANDOC_FILES)))
PANDOC_TEMPLATE ?= templates/post.html
PANDOC_LUA_FILTER ?= engine/links-to-html.lua
PANDOC_LUA_FILTER_IMG ?= engine/img-to-webp.lua
PANDOC_LUA_METAS ?= engine/metas.lua
MK_HTML := engine/mk-html.sh
PANDOC := $(MK_HTML) $(PANDOC_TEMPLATE) $(PANDOC_LUA_FILTER) $(PANDOC_LUA_FILTER_IMG) $(PANDOC_LUA_METAS)
$(DST_DIR)/%.html: $(SRC_DIR)/%.org $(PANDOC_TEMPLATE) $(PANDOC_LUA_FILTER) $(PANDOC_LUA_FILTER_IMG) $(PANDOC_LUA_METAS) $(MK_HTML) $(ENV_VARS)
@mkdir -p "$(dir $@)"
$(PANDOC) "$<" "$@.tmp"
minify --mime text/html "$@.tmp" > "$@"
@rm "$@.tmp"
.PHONY: html
html: $(DST_PANDOC_FILES)
ALL += html
# INDEXES
SRC_POSTS_DIR ?= $(SRC_DIR)/posts
DST_POSTS_DIR ?= $(DST_DIR)/posts
SRC_POSTS_FILES ?= $(shell find $(SRC_POSTS_DIR) -type f -name "*$(EXT)")
RSS_CACHE_DIR ?= $(CACHE_DIR)/rss
DST_XML_FILES ?= $(patsubst %.org,%.xml, \
$(patsubst $(SRC_POSTS_DIR)/%,$(RSS_CACHE_DIR)/%, \
$(SRC_POSTS_FILES)))
$(RSS_CACHE_DIR)/%.xml: $(DST_POSTS_DIR)/%.html $(ENV_VARS)
@mkdir -p "$(dir $@)"
hxclean "$<" > "$@"
.PHONY: indexcache
indexcache: $(DST_XML_FILES)
ALL += indexcache
# HTML INDEX
DST_INDEX_FILES ?= $(patsubst %.xml,%.index, $(DST_XML_FILES))
MK_INDEX_ENTRY := ./engine/mk-index-entry.sh
INDEX_CACHE_DIR ?= $(CACHE_DIR)/rss
$(INDEX_CACHE_DIR)/%.index: $(INDEX_CACHE_DIR)/%.xml $(MK_INDEX_ENTRY) $(ENV_VARS)
@mkdir -p $(INDEX_CACHE_DIR)
$(MK_INDEX_ENTRY) "$<" "$@"
HTML_INDEX := $(DST_DIR)/index.html
MKINDEX := engine/mk-index.sh
INDEX_TEMPLATE ?= templates/index.html
$(HTML_INDEX): $(DST_INDEX_FILES) $(MKINDEX) $(INDEX_TEMPLATE) $(ENV_VARS)
@mkdir -p $(DST_DIR)
$(MKINDEX)
.PHONY: index
index: $(HTML_INDEX)
ALL += index
# RSS
DST_RSS_FILES ?= $(patsubst %.xml,%.rss, $(DST_XML_FILES)) $(ENV_VARS)
MK_RSS_ENTRY := ./engine/mk-rss-entry.sh
$(RSS_CACHE_DIR)/%.rss: $(RSS_CACHE_DIR)/%.xml $(MK_RSS_ENTRY)
@mkdir -p $(RSS_CACHE_DIR)
$(MK_RSS_ENTRY) "$<" "$@"
RSS := $(DST_DIR)/rss.xml
MKRSS := engine/mkrss.sh
$(RSS): $(DST_RSS_FILES) $(MKRSS) $(ENV_VARS)
$(MKRSS)
.PHONY: rss
rss: $(RSS)
ALL += rss
# ORG -> GEMINI
EXT := .org
SRC_GMI_FILES ?= $(shell find $(SRC_DIR) -type f -name "*$(EXT)" $(NO_DRAFT))
DST_GMI_FILES ?= $(subst $(EXT),.gmi, \
$(patsubst $(SRC_DIR)/%,$(DST_DIR)/%, \
$(SRC_GMI_FILES)))
GMI := engine/org2gemini.sh
$(DST_DIR)/%.gmi: $(SRC_DIR)/%.org $(GMI) engine/org2gemini_step1.sh
@mkdir -p $(dir $@)
$(GMI) "$<" "$@"
ALL += $(DST_GMI_FILES)
.PHONY: gmi
gmi: $(DST_GMI_FILES)
# GEMINI INDEX
GMI_INDEX := $(DST_DIR)/index.gmi
MK_GMI_INDEX := engine/mk-gemini-index.sh
$(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX) $(ENV_VARS)
@mkdir -p $(DST_DIR)
$(MK_GMI_INDEX)
ALL += $(GMI_INDEX)
.PHONY: gmi-index
gmi-index: $(GMI_INDEX)
# RSS
GMI_ATOM := $(DST_DIR)/gem-atom.xml
MK_GEMINI_ATOM := engine/mk-gemini-atom.sh
$(GMI_ATOM): $(DST_GMI_FILES) $(MK_GEMINI_ATOM)
$(MK_GEMINI_ATOM)
ALL += $(GMI_ATOM)
.PHONY: gmi-atom
gmi-atom: $(GMI_ATOM)
.PHONY: gemini
gemini: $(DST_GMI_FILES) $(GMI_INDEX) $(GMI_ATOM)
# Images
OPTIM_IMG := engine/optim-img.sh
define img
SRC_IMG_$(1) ?= $$(shell find $$(SRC_DIR) -type f -name "*.$(1)")
DST_IMG_$(1) ?= $$(patsubst $$(SRC_DIR)/%,$$(DST_DIR)/%,$$(SRC_IMG_$(1)))
$$(DST_DIR)/%.$(1): $$(SRC_DIR)/%.$(1) $$(OPTIM_IMG)
@mkdir -p $$(dir $$@)
$$(OPTIM_IMG) "$$<" "$$@"
.PHONY: $(1)
$(1): $$(DST_IMG_$(1))
ALL += $(1)
endef
$(info $(call img,jpg))
$(eval $(call img,jpg))
$(eval $(call img,jpeg))
$(eval $(call img,gif))
$(eval $(call img,png))
.PHONY: img
img: jpg jpeg gif png
# DEPLOY
.PHONY: site
site: $(ALL)
.PHONY: deploy
deploy: $(ALL)
engine/sync.sh # deploy to her.esy.fun
engine/ye-com-fastpublish.hs # deploy to yannesposito.com (via github pages)
.PHONY: clean
clean:
-[ -f $(ENV_VARS) ] && rm $(ENV_VARS)
-[ ! -z "$(DST_DIR)" ] && rm -rf $(DST_DIR)/*
-[ ! -z "$(CACHE_DIR)" ] && rm -rf $(CACHE_DIR)/*

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
emacs --load .project.el.gpg --eval '(progn (delete-directory org-publish-timestamp-directory t) (org-publish "blog" t) (evil-quit))'

View file

@ -1,6 +0,0 @@
#!/usr/bin/env zsh
rootdir=${0:h}
echo $rootdir
rsync --progress --partial -avHe ssh $rootdir/_site/ root@shoggoth1:/var/www/her.esy.fun/ --delete

12
engine/auto-build.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
[[ -f ./engine/envvars.sh ]] || make ./engine/envvars.sh
source ./engine/envvars.sh
direnv reload
./engine/build.sh
echo "Watching $PWD/{src,templates}"
# fswatch --exclude='\\.#' src | while read event; do
fswatch --exclude='^.*\.#.*$' src engine templates | while read event; do
echo "$event"
./engine/build.sh
done

5
engine/build.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
make -j $(getconf _NPROCESSORS_ONLN)

26
engine/dev.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
## colors for tput
# black=0
red=1
green=2
yellow=3
blue=4
# magenta=5
# cyan=6
# white=7
green() { printf "$(tput setaf $green)%s$(tput sgr0)" "$*" }
yellow() { printf "$(tput setaf $yellow)%s$(tput sgr0)" "$*" }
blue() { printf "$(tput setaf $blue)%s$(tput sgr0)" "$*" }
pipegreen() {while read line; do green $line; done}
pipeyellow() {while read line; do yellow $line; done}
pipeblue() {while read line; do blue $line; done}
tee >(lorri watch | sed 's/^/[lorri] /' | pipegreen ) \
>(./engine/serve.sh | sed 's/^/[http] /' | pipeyellow) \
>(./engine/auto-build.sh | sed 's/^/[make] /' | pipeblue) \
>(sleep 1 && open 'http://127.0.0.1:3077')

9
engine/img-to-webp.lua Normal file
View file

@ -0,0 +1,9 @@
-- img-to-webp.lua
function Image(el)
local fileext = el.src:match("%.[^%.]+$");
-- DEBUG -- print("LUA IMG: ", fileext);
if ( fileext == ".jpg" or fileext == ".png" or fileext == ".jpeg" ) then
el.src = el.src .. ".webp"
end
return el
end

27
engine/lighttpd.conf Normal file
View file

@ -0,0 +1,27 @@
server.bind = "0.0.0.0"
server.port = 3077
server.document-root = var.CWD + "/_site/"
index-file.names = ( "index.html" )
mimetype.assign = (
".css" => "text/css",
".gif" => "image/gif",
".htm" => "text/html",
".html" => "text/html",
".jpeg" => "image/jpeg",
".jpg" => "image/jpeg",
".js" => "text/javascript",
".png" => "image/png",
".swf" => "application/x-shockwave-flash",
".txt" => "text/plain",
".gmi" => "text/plain",
".svg" => "image/svg+xml",
".svgz" => "image/svg+xml"
)
# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
server.max-keep-alive-requests = 0
}

5
engine/links-to-html.lua Normal file
View file

@ -0,0 +1,5 @@
-- links-to-html.lua
function Link(el)
el.target = string.gsub(string.gsub(el.target, "%.org", ".html"), "%.html::", ".html#" )
return el
end

22
engine/metas.lua Normal file
View file

@ -0,0 +1,22 @@
-- intermediate store for variables and their values
local variables = {}
--- Function called for each raw block element.
function RawBlock (raw)
-- Don't do anything unless the block contains *org* markup.
if raw.format ~= 'org' then return nil end
-- extract variable name and value
local name, value = raw.text:match '#%+(%w+):%s*(.+)$'
if name and value then
variables[name] = value
end
end
-- Add the extracted variables to the document's metadata.
function Meta (meta)
for name, value in pairs(variables) do
meta[name] = value
end
return meta
end

113
engine/mk-gemini-atom.sh Executable file
View file

@ -0,0 +1,113 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
# Directory
webdir="_site"
postsdir="$webdir/posts"
rssfile="$webdir/gem-atom.xml"
# maximal number of articles to put in the RSS file
maxarticles=10
# RSS Metas
rsstitle="her.esy.fun"
rssurl="gemini://her.esy.fun/gem-atom.xml"
websiteurl="gemini://her.esy.fun"
rssdescription="her.esy.fun articles, mostly random personal thoughts"
rsslang="en"
rssauthor="yann@esposito.host (Yann Esposito)"
rssimgurl="gemini://her.esy.fun/img/FlatAvatar.png"
# title and keyword shouldn't be changed
formatdate() {
# format the date for RSS
local d=$1
LC_TIME=en_US date --date $d +'%a, %d %b %Y %H:%M:%S %z'
}
finddate(){ < $1 | awk '/^date: /' | head -n1 | perl -pe 's/^.*\[//;s/ .*$//;' }
findtitle(){ < $1 | head -n1 | perl -pe 's/^# //' }
getcontent(){
< $1 perl -pe 'use URI; $base="'$2'"; s# (href|src)="((?!https?://)[^"]*)"#" ".$1."=\"".URI->new_abs($2,$base)->as_string."\""#eig' }
findkeywords(){ < $1 | awk '/^keywords: /' | head -n1 | sed 's/keywords: //' }
mkcategories(){
for keyword in $*; do
printf "\\n<category>%s</category>" $keyword
done
}
autoload -U colors && colors
tmpdir=$(mktemp -d)
typeset -a dates
dates=( )
for fic in $postsdir/**/*.gmi; do
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
printf "%-30s" $postfile
xfic="$fic"
d=$(finddate $xfic)
echo -n " [$d]"
rssdate=$(formatdate $d)
title=$(findtitle $xfic)
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"
categories=$(mkcategories $keywords)
absoluteurl="${websiteurl}/${blogfile}"
{ printf "\\n<item>"
printf "\\n<title>%s</title>" "$title"
printf "\\n<guid>%s</guid>" "$absoluteurl"
printf "\\n<pubDate>%s</pubDate>%s" "$rssdate"
printf "%s" "$categories"
printf "\\n<description><![CDATA[\\n%s\\n]]></description>" "$(getcontent "$xfic" "$absoluteurl")"
printf "\\n</item>\\n\\n"
} >> "$tmpdir/${d}-$(basename $fic).rss"
dates=( $d $dates )
echo " [${fg[green]}OK${reset_color}]"
done
echo "Publishing"
for fic in $(ls $tmpdir/*.rss | sort -r | head -n $maxarticles ); do
echo "${fic:t}"
cat $fic >> $tmpdir/rss
done
rssmaxdate=$(formatdate $(for d in $dates; do echo $d; done | sort -r | head -n 1))
rssbuilddate=$(formatdate $(date))
{
cat <<END
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:georss="http://www.georss.org/georss"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:media="http://search.yahoo.com/mrss/"><channel>
<title>${rsstitle}</title>
<atom:link href="${rssurl}" rel="self" type="application/rss+xml" />
<link>${websiteurl}</link>
<description><![CDATA[${rssdescription}]]></description>
<language>${rsslang}</language>
<pubDate>${rssmaxdate}</pubDate>
<lastBuildDate>$rssbuilddate</lastBuildDate>
<generator>mkrss.sh</generator>
<webMaster>${rssauthor}</webMaster>
<image>
<url>${rssimgurl}</url>
<title>${rsstitle}</title>
<link>${websiteurl}</link>
</image>
END
cat $tmpdir/rss
cat <<END
</channel>
</rss>
END
} > "$rssfile"
rm -rf $tmpdir
echo "* Gemini Atom [done]"

84
engine/mk-gemini-index.sh Executable file
View file

@ -0,0 +1,84 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"
indexfile="$webdir/index.gmi"
# maximal number of articles to put in the RSS file
maxarticles=100
# RSS Metas
rsstitle="her.esy.fun"
websiteurl="gemini://her.esy.fun"
rssdescription="her.esy.fun articles, mostly random personal thoughts"
rsslang="en"
rssauthor="yann@esposito.host (Yann Esposito)"
# title and keyword shouldn't be changed
formatdate() {
# format the date for RSS
local d=$1
LC_TIME=en_US date --date $d +'%Y-%m-%d'
}
finddate(){ < $1 | awk '/^date: /' | head -n1 | perl -pe 's/^.*\[//;s/ .*$//;' }
findtitle(){ < $1 | head -n1 | perl -pe 's/^# //' }
getcontent(){
< $1 perl -pe 'use URI; $base="'$2'"; s# (href|src)="((?!https?://)[^"]*)"#" ".$1."=\"".URI->new_abs($2,$base)->as_string."\""#eig' }
findkeywords(){ < $1 | awk '/^keywords: /' | head -n1 | sed 's/keywords: //' }
autoload -U colors && colors
tmpdir=$(mktemp -d)
typeset -a dates
dates=( )
for fic in $postsdir/**/*.gmi; do
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
printf "%-30s" $postfile
xfic="$fic"
d=$(finddate $xfic)
echo -n " [$d]"
rssdate=$(formatdate $d)
title=$(findtitle $xfic)
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"
absoluteurl="${websiteurl}/${blogfile}"
{
printf "=> %s %s: %s [%s]\n" "$absoluteurl" "$rssdate" "$title" "$keywords"
} >> "$tmpdir/${d}-$(basename $fic).gmi"
dates=( $d $dates )
echo " [${fg[green]}OK${reset_color}]"
done
echo "Publishing"
for fic in $(ls $tmpdir/*.gmi | sort -r | head -n $maxarticles ); do
echo "${fic:t}"
cat $fic >> $tmpdir/gmi
done
rssmaxdate=$(formatdate $(for d in $dates; do echo $d; done | sort -r | head -n 1))
rssbuilddate=$(formatdate $(date))
{
cat <<END
,---,
/ <=> \\
( (O) )
\\ /
'---'
YOGSOTOTH
The index of my articles.
I talk about programming and sometime movies.
Some articles are only intended for gemini.
Enjoy!
END
cat $tmpdir/gmi
} > "$indexfile"
rm -rf $tmpdir
echo "* Gemini Index [done]"

28
engine/mk-html.sh Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -eu
cd "$(git rev-parse --show-toplevel)" || exit 1
template="$1"
luafilter="$2"
luafilterimg="$3"
luametas="$4"
orgfile="$5"
htmlfile="$6"
tocoption=""
if grep -ie '^#+options:' "$orgfile" | grep 'toc:t'>/dev/null; then
tocoption="--toc"
fi
set -x
pandoc $tocoption \
--template="$template" \
--lua-filter="$luafilter" \
--lua-filter="$luafilterimg" \
--lua-filter="$luametas" \
--mathml \
--from org \
--to html5 \
--standalone \
$orgfile \
--output "$htmlfile"

35
engine/mk-index-entry.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
xfic="$1"
dst="$2"
# Directory
indexdir=".cache/rss"
# HTML Accessors (similar to CSS accessors)
dateaccessor='.yyydate'
# title and keyword shouldn't be changed
titleaccessor='title'
keywordsaccessor='meta[name=keywords]::attr(content)'
finddate(){ < $1 hxselect -c $dateaccessor | sed 's/\[//g;s/\]//g;s/ .*$//' }
findtitle(){ < $1 hxselect -c $titleaccessor }
findkeywords(){ < $1 hxselect -c $keywordsaccessor | sed 's/,/ /g' }
autoload -U colors && colors
blogfile="$(echo "$xfic"|sed 's#.xml$#.html#;s#^'$indexdir'/#posts/#')"
printf "%-30s" $blogfile
d=$(finddate $xfic)
echo -n " [$d]"
title=$(findtitle $xfic)
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"
{ printf "\\n<li>"
printf "\\n<span class=\"pubDate\">%s</span>" "$d"
printf "\\n<span class=\"post-title\"><a href=\"%s\">%s</a></span>" "${blogfile}" "$title"
printf "\\n</li>\\n\\n"
} > ${dst}
echo " [${fg[green]}OK${reset_color}]"

63
engine/mk-index.sh Executable file
View file

@ -0,0 +1,63 @@
#!/usr/bin/env zsh
autoload -U colors && colors
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
indexfile="$webdir/index.html"
indexdir=".cache/rss"
tmpdir=$(mktemp -d)
echo "Publishing"
dateaccessor='.pubDate'
finddate(){ < $1 hxselect -c $dateaccessor }
# generate files with <DATE>-<FILENAME>.index
for fic in $indexdir/**/*.index; do
d=$(finddate $fic)
echo "${${fic:h}:t} [$d]"
cp $fic $tmpdir/$d-${${fic:h}:t}.index
done
# for every post in reverse order
# generate the body (there is some logic to group by year)
previousyear=""
for fic in $(ls $tmpdir/*.index | sort -r); do
d=$(finddate $fic)
year=$( echo "$d" | perl -pe 's#(\d{4})-.*#$1#')
if (( year != previousyear )); then
if (( previousyear > 0 )); then
echo "</ul>" >> $tmpdir/index
fi
previousyear=$year
echo "<h3 name=\"${year}\" >${year}</h3><ul>" >> $tmpdir/index
fi
cat $fic >> $tmpdir/index
done
echo "</ul>" >> $tmpdir/index
title="Home"
description="Most recent articles"
author="Yann Esposito"
body=$(< $tmpdir/index)
date=$(LC_TIME=en_US date +'%Y-%m-%d')
# A neat trick to use pandoc template within a shell script
# the pandoc templates use $x$ format, we replace it by just $x
# to be used with envsubst
template=$(< templates/index.html | \
sed 's/\$\(header-includes\|table-of-content\)\$//' | \
sed 's/\$if.*\$//' | \
perl -pe 's#(\$[^\$]*)\$#$1#g' )
{
export title
export author
export description
export date
export body
echo ${template} | envsubst
} > "$indexfile"
rm -rf $tmpdir
echo "* HTML INDEX [done]"

68
engine/mk-rss-entry.sh Executable file
View file

@ -0,0 +1,68 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"
indexdir=".cache/rss"
# file to handle
fic="$1"
dst="$2"
# RSS Metas
websiteurl="https://her.esy.fun"
# HTML Accessors (similar to CSS accessors)
dateaccessor='.yyydate'
contentaccessor='#content'
# title and keyword shouldn't be changed
titleaccessor='title'
keywordsaccessor='meta[name=keywords]::attr(content)'
formatdate() {
# format the date for RSS
local d="$1"
# echo "DEBUG DATE: $d" >&2
LC_TIME=en_US date --date $d +'%a, %d %b %Y %H:%M:%S %z'
}
finddate(){ < $1 hxselect -c $dateaccessor | sed 's/\[//g;s/\]//g;s/ .*$//' }
findtitle(){ < $1 hxselect -c $titleaccessor }
getcontent(){
< $1 hxselect $contentaccessor | \
perl -pe 'use URI; $base="'$2'"; s# (href|src)="((?!https?://)[^"]*)"#" ".$1."=\"".URI->new_abs($2,$base)->as_string."\""#eig' }
findkeywords(){ < $1 hxselect -c $keywordsaccessor | sed 's/,/ /g' }
mkcategories(){
for keyword in $*; do
printf "\\n<category>%s</category>" $keyword
done
}
autoload -U colors && colors
xfic="$fic"
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
blogfile="$(echo "$fic"|sed 's#.xml$#.html#;s#^'$indexdir'/#posts/#')"
printf "%-30s" $blogfile
d=$(finddate $xfic)
echo -n " [$d]"
rssdate=$(formatdate $d)
title=$(findtitle $xfic)
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"
categories=$(mkcategories $keywords)
absoluteurl="${websiteurl}/${blogfile}"
[[ ! -d $(dirname $dst) ]] && mkdir -p $(dirname $dst)
{ printf "\\n<item>"
printf "\\n<title>%s</title>" "$title"
printf "\\n<guid>%s</guid>" "$absoluteurl"
printf "\\n<pubDate>%s</pubDate>%s" "$rssdate"
printf "%s" "$categories"
printf "\\n<description><![CDATA[\\n%s\\n]]></description>" "$(getcontent "$xfic" "$absoluteurl")"
printf "\\n</item>\\n\\n"
} > "${dst}"
echo " [${fg[green]}OK${reset_color}]"

108
engine/mkrss.sh Executable file
View file

@ -0,0 +1,108 @@
#! /usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"
rssfile="$webdir/rss.xml"
indexdir=".cache/rss"
# maximal number of articles to put in the RSS file
maxarticles=10
# RSS Metas
rsstitle="her.esy.fun"
rssurl="https://her.esy.fun/rss.xml"
websiteurl="https://her.esy.fun"
rssdescription="her.esy.fun articles, mostly random personal thoughts"
rsslang="en"
rssauthor="yann@esposito.host (Yann Esposito)"
rssimgurl="https://her.esy.fun/img/FlatAvatar.png"
# HTML Accessors (similar to CSS accessors)
dateaccessor='pubDate'
formatdate() {
# format the date for RSS
local d="$1"
# echo "DEBUG DATE: $d" >&2
LC_TIME=en_US date --date $d +'%a, %d %b %Y %H:%M:%S %z'
}
isodate() {
# format the date for sorting
local d="$1"
# echo "DEBUG DATE: $d" >&2
LC_TIME=en_US date --date "$d" +'%Y-%m-%dT%H:%M:%S'
}
finddate(){ < $1 hxselect -c $dateaccessor }
autoload -U colors && colors
typeset -a dates
dates=( )
tmpdir=$(mktemp -d)
for fic in $indexdir/**/*.rss; do
rssdate=$(finddate $fic)
echo -n "${${fic:h}:t} [$rssdate]"
d=$(isodate $rssdate)
dates=( $d $dates )
echo " [${fg[green]}OK${reset_color}]"
cp $fic $tmpdir/$d-${${fic:h}:t}.rss
done
echo "Publishing"
n=1
for fic in $(ls $tmpdir/*.rss | sort -r | head -n $maxarticles ); do
echo "$((n++)) ${fic:t}"
cat $fic >> $tmpdir/rss
done
rssmaxdate=$(formatdate $(for d in $dates; do echo $d; done | sort -r | head -n 1))
rssbuilddate=$(formatdate $(date))
{
cat <<END
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:georss="http://www.georss.org/georss"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:media="http://search.yahoo.com/mrss/"><channel>
<title>${rsstitle}</title>
<atom:link href="${rssurl}" rel="self" type="application/rss+xml" />
<link>${websiteurl}</link>
<description><![CDATA[${rssdescription}]]></description>
<language>${rsslang}</language>
<pubDate>${rssmaxdate}</pubDate>
<lastBuildDate>$rssbuilddate</lastBuildDate>
<generator>mkrss.sh</generator>
<webMaster>${rssauthor}</webMaster>
<image>
<url>${rssimgurl}</url>
<title>${rsstitle}</title>
<link>${websiteurl}</link>
</image>
END
cat $tmpdir/rss
cat <<END
</channel>
</rss>
END
} > "$rssfile"
# HACK TO UPDATE OLD RSS FEEDS
legacyenrss="$webdir/Scratch/en/blog/feed/feed.xml"
legacyfrrss="$webdir/Scratch/fr/blog/feed/feed.xml"
mkdir -p "${legacyenrss:h}"
mkdir -p "${legacyfrrss:h}"
cp -f "$rssfile" "$legacyenrss"
cp -f "$rssfile" "$legacyfrrss"
rm -rf $tmpdir
echo "\* RSS [done]"

36
engine/new-post.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env zsh
(( $# < 1 )) && {
print -- "usage: ${0:t} title"
exit 1
}
postsdir=src/posts
title="$*"
scrub=$(echo "$title" | tr '[:upper:]' '[:lower:]' | perl -pe 's/[^a-z0-9_]+/-/g;s/-+$//')
lastnumber () {
for d in "$postsdir"/*; do
number=$(echo "${d:t}" | sed 's/-.*$//')
echo "$number"
done | sort -n | tail -n 1
}
n=$(lastnumber)
newdir=$(printf "%04d-%s" $((n+1)) "$scrub")
dst="$postsdir/$newdir/index.org"
today=$(date +"[%Y-%m-%d %a]")
mkdir "${dst:h}"
cat > "$dst" <<EOF
#+title: $title
#+description:
#+keywords: blog static
#+author: Yann Esposito
#+email: yann@esposito.host
#+date: $today
#+lang: en
#+options: auto-id:t
#+startup: showeverything
EOF

32
engine/optim-img.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env zsh
src="$1"
dst="$2"
sizeof() {
stat --format="%s" "$*"
}
convert "$src" -resize 800x800\> "$dst"
before=$(sizeof $src)
if [[ "${src:e}" == "gif" ]]; then
after=$(sizeof $dst)
dest=$dst
else
cwebp "$dst" -quiet -o "$dst.webp"
after=$(sizeof $dst.webp)
dest=$dst.webp
fi
if (( before <= after )); then
cp -f "$src" "$dst"
print -- "[0%] cp $before => $before"
else
gain=$(( ( (before - after) * 100 ) / before ))
print -- "[$gain%] convert $before => $after"
fi

29
engine/org2gemini.sh Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit 1
src="$1"
dst="$2"
./engine/org2gemini_step1.sh "$src" | \
perl -pe 's#^email:\s+yann\@esposito.host\s*#$&=> /files/publickey.txt gpg\n#g;' | \
perl -pe 's# ?\[\[([^]]*)\]\[([^]]*)\]\]#\n\n=> $1 $2\n#g;' | \
perl -pe 's#=> file:([^ ]*)\.org#=> $1.gmi#g;' | \
perl -pe 's#=> file:([^ ]*)#=> $1#g;' | \
perl -pe 's#\[\[(file:)?([^]]*)\]\]#=> $2#g;' | \
perl -pe 's#^\* *\n\n##' | \
# remove lines with a single special char
perl -pe 's#^\s*[-\*\+\.]\s*$##' | \
perl -pe 's#^\**[ ]*:.*:$##' | \
perl -pe 's#^\s[- ]*$#\n#;' > "$dst"
{ echo ""
echo "=> /index.gmi Home"
echo "=> /gem-atom.xml Feed"
echo "=> /slides.gmi Slides"
echo "=> /about-me.gmi About"
echo ""
echo "=> https://gitea.esy.fun code"
echo "=> https://espial.esy.fun/u:yogsototh bookmarks"
echo "=> https://espial.esy.fun/u:yogsototh/notes notes"
} >> "$dst"

36
engine/org2gemini_step1.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env awk -f
BEGIN { IGNORECASE=1; }
{ skip=0; }
/^#\+(BEGIN|END)_SRC ?/i { gsub(/#\+(BEGIN|END)_SRC ?/,"```"); }
/^#\+(BEGIN|END)_[^ ]* ?/i { gsub(/#\+(BEGIN|END)_([^ ]*) ?/,"______"); }
/^#\+(macro|lang|language|options|startup|html_head|html_head_extra):/ { skip=1; }
/{{{br}}}/ { gsub(/{{{br}}}/,""); }
/{{{pemail}}}/ { gsub(/{{{pemail}}}/,"yann@esposito.host"); }
/^#\+TITLE: / { gsub(/^#[^:]*: /,"# "); }
/^ *:[a-zA-Z_0-9]*:/ { skip=1; }
# title
/^\* / { gsub(/^\* /,"# "); }
/^\*\* / { gsub(/^\*\* /,"## "); }
/^\*\*\* / { gsub(/^\*\*\* /,"### "); }
/@@html:/ { htmlskip = 1; }
!skip && /^#\+([^:]*):/ {
x=$1;
gsub(/^#\+/,"",x);
x=tolower(x);
gsub(/^#\+([^:]*):/,"",$0);
$0=x" "$0;
}
/^- / { gsub(/^- /,"* "); }
!skip && !htmlskip{
print;
}
/@@/ && !/@@html:/ { htmlskip = 0; }
/@@$/ { htmlskip = 0; }

18
engine/pre-deploy.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit 1
echo "Copying to optim dir"
find _optim -mindepth 1 -not -path "_optim/.gitignore" -delete && \
cp -r _site/* _optim
echo "Optim HTML size"
./engine/optim-html.sh
# echo "Gen themes clones"
# ./engine/dup-for-themes.sh
# echo "Optim Classes accross CSS/HTML"
# ./engine/optim-classes.sh
# echo "Update file size"
# ./engine/update-file-size.sh
echo "Building RSS"
./engine/mkrss.sh
echo "Building Gemini Atom"
./engine/mk-gemini-atom.sh

3
engine/search-bad-keywords.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
rg -w '#\+keywords:.*,' -t org

7
engine/serve.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit 1
webdir="_site"
echo "Serving: $webdir on http://localhost:3077" && \
lighttpd -f ./engine/lighttpd.conf -D

View file

@ -1,5 +1,6 @@
#!/usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit 1
signer=yann@esposito.host
gpg --local-user $signer --output project.el.sig --detach-sign project.el

14
engine/sync.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
webdir="_site"
[[ -d $webdir ]] || { echo "no $webdir directory"; exit 1 }
echo -n "Uploading website"
rsync --progress\
--partial \
--delete \
--exclude '.git' \
-avHe ssh ${webdir}/ root@esy.fun:/var/www/her.esy.fun/
echo " [done]"

79
engine/update-file-size.sh Executable file
View file

@ -0,0 +1,79 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
webdir="_optim"
sizeof() {
stat --format="%s" "$*"
}
debug () {
print -- $* >/dev/null
}
toh () {
numfmt --to=iec $*
}
tmpdir=$(mktemp -d)
type -a filelist
if (($#>0)); then
filelist=( $* )
else
filelist=( $webdir/*/*.html(.) $webdir/posts/*.html )
fi
for fic in $filelist; do
print -n -- "$fic "
htmlsize=$(sizeof $fic)
debug HTML: $htmlsize
gzhtmlsize=$( gzip -c $fic|wc -c )
debug GZHTML: $gzhtmlsize
xfic=$tmpdir/$fic
mkdir -p $(dirname $xfic)
hxclean $fic > $xfic
images=( $( < $xfic hxselect -i -c -s '\n' 'img::attr(src)' | sed 's/^\.\.\///' ) )
imgsize=0
nbimg=0
for i in $images; do
((nbimg++))
isize=$( sizeof ${fic:h}/$i )
debug $i '=>' $isize
(( imgsize += isize ))
done
debug IMG: $imgsize
css=( $( < $xfic hxselect -i -c -s '\n' 'link[rel=stylesheet]::attr(href)'))
csssize=0
gzcsssize=0
for i in $css; do
isize=$( sizeof $webdir/$i )
gzisize=$( gzip -c $webdir/$i | wc -c )
debug $i '=>' $isize
(( csssize += isize ))
(( gzcsssize += gzisize ))
done
debug CSS: $csssize
debug GZCSS: $gzcsssize
total=$(( htmlsize + imgsize + csssize ))
gztotal=$(( gzhtmlsize + imgsize + gzcsssize ))
# the space is important before the toh total
sizeinfos=$(print -- " $(toh $total) (html $(toh $htmlsize), css $(toh $csssize)")
gzsizeinfos=$(print -- " $(toh $gztotal) (html $(toh $gzhtmlsize), css $(toh $gzcsssize)")
if ((imgsize>0)); then
sizeinfos="$sizeinfos, img $(toh $imgsize))"
gzsizeinfos="$gzsizeinfos, img $(toh $imgsize))"
else
sizeinfos="$sizeinfos)"
gzsizeinfos="$gzsizeinfos)"
fi
print -- $sizeinfos
perl -pi -e 's#(<span class="?webfilesize"?>)[^<]*(</span>)#$1'"$sizeinfos"'$2#;s#(<span class="?gzwebfilesize"?>)[^<]*(</span>)#$1'"$gzsizeinfos"'$2#' $fic
done
rm -rf $tmpdir

88
engine/ye-com-fastpublish.hs Executable file
View file

@ -0,0 +1,88 @@
#!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
import Turtle
import Prelude hiding (FilePath)
import qualified Control.Foldl as Fold
import Data.Maybe (fromMaybe)
import System.Console.ANSI
import Turtle.Line (unsafeTextToLine)
import Control.Exception (catches,Handler(..))
main = mainProc `catches` [ Handler handleShellFailed
, Handler handleProcFailed
]
handleShellFailed :: ShellFailed -> IO ()
handleShellFailed (ShellFailed cmdLine _) = do
setSGR [SetColor Foreground Dull Red]
echo $ ("[FAILED]: " <> unsafeTextToLine cmdLine)
setSGR [Reset]
handleProcFailed :: ProcFailed -> IO ()
handleProcFailed (ProcFailed procCmd procArgs _) = do
setSGR [SetColor Foreground Dull Red]
echo $ unsafeTextToLine ("[FAILED]: " <> procCmd <> (mconcat procArgs))
setSGR [Reset]
mainProc :: IO ()
mainProc = do
-- So we can't have access to $0 in Haskell via stack.
-- Too bad.
-- So instead, I'll check I'm in the right directory.
debug "Checking directory"
pubdir <- checkDir
debug "Retrieving revision number"
rev <- fold (inshell "git rev-parse --short HEAD" empty) Fold.head
debug ("Revision number retrieved: " <> fromMaybe "unknow" rev)
debug $ unsafeTextToLine $ "cd " <> (format fp pubdir)
cd pubdir
pwd >>= echo . unsafeTextToLine . format fp
dshells "rm -rf .git"
dshells "git init ."
dshell ("git remote add upstream " <> mainRepository)
dshells "git fetch --depth 1 upstream gh-pages"
dshells "git reset upstream/gh-pages"
dshells "git add -A ."
echo "Commit and publish"
dshells ("git commit -m \"publishing at rev " <> lineToText (fromMaybe "unknow" rev) <> "\"")
echo "Don't `git push` this time"
dshells "git push -q upstream HEAD:gh-pages"
debug :: Line -> IO ()
debug txt = do
setSGR [SetColor Foreground Dull Yellow]
echo txt
setSGR [Reset]
dshells :: Text -> IO ()
dshells x = do
debug $ unsafeTextToLine x
shells x empty
dshell :: Text -> IO ExitCode
dshell x = do
debug $ unsafeTextToLine x
shell x empty
checkDir :: IO FilePath
checkDir = do
toolsExists <- testdir "engine"
if (not toolsExists)
then exit (ExitFailure 1)
else return "_site"
mainRepository :: Text
mainRepository = "git@github.com:yogsototh/yannesposito.com.git"
cloneIfNeeded :: FilePath -> IO ()
cloneIfNeeded pubdir = do
contentExists <- testdir pubdir
when (not contentExists) $
procs "git"
[ "clone"
, "-b", "gh-pages"
, mainRepository
, format fp pubdir]
empty

6
logo-svg.org Normal file
View file

@ -0,0 +1,6 @@
<svg width="5em" viewBox="0 0 64 64">
<circle cx="32" cy="32" r="30" stroke="#a3aec2" stroke-width="1" fill="#2E3440"></circle>
<circle cx="32" cy="32" r="12" stroke="#800" stroke-width="1" fill="#c20"></circle>
<circle cx="32" cy="32" r="5" stroke-width="1" stroke="#f60" fill="#fa0"></circle>
<ellipse cx="32" cy="14" rx="14" ry="8" stroke-width="0" fill="#FFF"></ellipse>
</svg>

After

Width:  |  Height:  |  Size: 390 B

38
nix/sources.json Normal file
View file

@ -0,0 +1,38 @@
{
"ghc.nix": {
"branch": "master",
"description": "Nix (shell) expression for working on GHC",
"homepage": "https://haskell.org/ghc/",
"owner": "alpmestan",
"repo": "ghc.nix",
"rev": "c31bcab7a74569e6bd37dbe7de94c97cad1e35e1",
"sha256": "05g4v4rgq0zh35461b3cv9p13pyg27pipfq3ia8zdmrlmwnvpxpd",
"type": "tarball",
"url": "https://github.com/alpmestan/ghc.nix/archive/c31bcab7a74569e6bd37dbe7de94c97cad1e35e1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "723f0eeb969a730db3c30f977c2b66b9dce9fe4a",
"sha256": "0016l7230gd2kdh0g2w573r9a2krqb7x4ifcjhhsn4h1bwap7qr0",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/723f0eeb969a730db3c30f977c2b66b9dce9fe4a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixpkgs-23.05-darwin",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2e7346c2d611c1b40e1cf74f177b2b1a329782ce",
"sha256": "0fazcnxlc9xpcvljlj7xxc6p2450vfngpf39xvskrjs8jlzp4hr9",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/2e7346c2d611c1b40e1cf74f177b2b1a329782ce.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

198
nix/sources.nix Normal file
View file

@ -0,0 +1,198 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
spec.ref or (
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
);
submodules = spec.submodules or false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{ }
else { };
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> { }
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
)
config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View file

@ -1,296 +0,0 @@
;; sign it with
;; gpg --local-user yann@esposito.host --output project.el.sig --detach-sign project.el
(defvar domainname "https://her.esy.fun")
(defvar base-dir (concat (projectile-project-root) "src"))
(defvar publish-dir (concat (projectile-project-root) "_site"))
(defvar assets-dir (concat base-dir "/"))
(defvar publish-assets-dir (concat publish-dir "/"))
(defvar posts-dir (concat base-dir "/posts"))
(defvar rss-title "Subscribe to articles")
(defvar rss-description "her.esy.fun articles, mostly random personal thoughts")
(defvar posts-descr "Articles")
(defvar css-path "/css/minimalist.css")
(defvar author-name "Yann Esposito")
(defvar author-email "yann@esposito.host")
(require 'org)
(require 'ox-publish)
(require 'ox-html)
(require 'org-element)
(require 'ox-rss)
;; (setq org-link-file-path-type 'relative)
(setq org-publish-timestamp-directory
(concat (projectile-project-root) "_cache/"))
(defvar org-blog-head
(concat
"<link rel=\"stylesheet\" type=\"text/css\" href=\"" css-path "\"/>"
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
"<link rel=\"alternative\" type=\"application/rss+xml\" title=\"" rss-title "\" href=\"/rss.xml\" />"
"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\">"))
(defun menu (lst)
"Blog menu"
(concat
"<navigation>"
(mapconcat 'identity
(append
'("<a href=\"/index.html\">Home</a>"
"<a href=\"/archive.html\">Posts</a>"
"<a href=\"/slides.html\">Slides</a>"
"<a href=\"/about-me.html\">About</a>")
lst)
" | ")
"</navigation>"))
(defun str-time-to-year-float (date-str)
(/ (float-time
(apply 'encode-time
(mapcar (lambda (x) (if (null x) 0 x))
(parse-time-string date-str))))
(* 365.25 24 60 60)))
(defvar blog-creation-date "2019-07-01")
(defun y-date (date-str)
"Number of year since the begining of this blog"
(let ((y (- (str-time-to-year-float date-str)
(str-time-to-year-float blog-creation-date))))
(format "∆t=%.2f" y)))
(defun get-from-info (info k)
(let ((i (car (plist-get info k))))
(when (and i (stringp i))
i)))
(defun org-blog-preamble (info)
"Pre-amble for whole blog."
(concat
"<div class=\"content\">"
(menu '("<a href=\"#postamble\">↓ bottom ↓</a>"))
"<h1>"
(format "%s" (car (plist-get info :title)))
"</h1>"
(when-let ((date (plist-get info :date)))
(format "<span class=\"article-date\">%s</span>"
(format-time-string "%Y-%m-%d"
(org-timestamp-to-time
(car date)))))
(when-let ((subtitle (car (plist-get info :subtitle))))
(format "<h2>%s</h2>" subtitle))
"</div>"))
(defun rand-obfs (c)
(let ((r (% (random) 20)))
(cond ;; ((eq 0 r) (format "%c" c))
((<= 0 r 10) (format "&#%d;" c))
(t (format "&#x%X;" c)))))
(defun obfuscate-html (txt)
(apply 'concat
(mapcar 'rand-obfs txt)))
(defun org-blog-postamble (info)
"Post-amble for whole blog."
(concat
"<div class=\"content\">"
;; TODO install a comment system
;; (let ((url (format "%s%s" domainname (replace-regexp-in-string base-dir "" (plist-get info :input-file)))))
;; (format "<a href=\"https://comments.esy.fun/slug/%s\">comment</a>"
;; (url-hexify-string url)))
"<footer>"
(when-let ((author (get-from-info info :author)))
(if-let ((email (plist-get info :email)))
(let* ((obfs-email (obfuscate-html email))
(obfs-author (obfuscate-html author))
(obfs-title (obfuscate-html (get-from-info info :title)))
(full-email (format "%s &lt;%s&gt;" obfs-author obfs-email)))
(format "<div class=\"author\">Author: <a href=\"%s%s%s%s\">%s</a></div>"
(obfuscate-html "mailto:")
full-email
(obfuscate-html "?subject=yblog: ")
obfs-title
full-email))
(format "<div class=\"author\">Author: %s</div>" author)))
(when-let ((date (get-from-info info :date)))
(format "<div class=\"date\">Created: %s (%s)</div>" date (y-date date)))
(when-let ((keywords (plist-get info :keywords)))
(format "<div class=\"keywords\">Keywords: <code>%s</code></div>" keywords))
(format "<div class=\"date\">Generated: %s</div>"
(format-time-string "%Y-%m-%d %H:%M:%S"))
(format (concat "<div class=\"creator\"> Generated with "
"<a href=\"https://www.gnu.org/software/emacs/\" target=\"_blank\" rel=\"noopener noreferrer\">Emacs %s</a>, "
"<a href=\"http://spacemacs.org\" target=\"_blank\" rel=\"noopener noreferrer\">Spacemacs %s</a>, "
"<a href=\"http://orgmode.org\" target=\"_blank\" rel=\"noopener noreferrer\">Org Mode %s</a>"
"</div>")
emacs-version spacemacs-version org-version)
"</footer>"
(menu '("<a href=\"#preamble\">↑ Top ↑</a>"))
"</div>"))
(defun date-format-entry (entry _style project)
"Return string for each ENTRY in PROJECT."
(when (string-match "posts/.*" entry)
(let* ((file (org-publish--expand-file-name entry project))
(title (org-publish-find-title entry project))
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))))
(format "- [%s] [[file:%s][%s]]\n" date file title))))
(defun org-blog-sitemap-fn-descr (descr title list)
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
(concat "#+TITLE: " title "\n"
"#+AUTHOR: " author-name "\n"
"#+EMAIL: " author-email "\n"
"#+DESCRIPTION: " descr "\n"
(mapconcat (lambda (li) (format "%s" (car li)))
(seq-filter #'car (cdr list))
"\n")))
(defun org-blog-publish-to-html (plist filename pub-dir)
"Same as `org-html-publish-to-html' but modifies html before finishing."
(let ((file-path (org-html-publish-to-html plist filename pub-dir)))
(with-current-buffer (find-file-noselect file-path)
(goto-char (point-min))
(search-forward "<body>")
(insert (mapconcat 'identity
'("<input id=\"light\">"
"<input id=\"raw\">"
"<input id=\"modern\">"
"<input id=\"dark\">"
"<input id=\"darkraw\">"
"<div id=\"labels\">"
"<div class=\"content\">"
"Change theme: "
"<a href=\"#light\">light</a>"
"(<a href=\"#raw\">raw</a>,"
"<a href=\"#modern\">modern</a>)"
" / "
"<a href=\"#dark\">dark</a>"
"(<a href=\"#darkraw\">raw</a>)"
"</div>"
"</div>")
"\n"))
(save-buffer)
(kill-buffer))
file-path))
(defun org-blog-publish-attachment (plist filename pub-dir)
"Publish a file with no transformation of any kind.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory.
Take care of minimizing the pictures using imagemagick.
Return output file name."
(unless (file-directory-p pub-dir)
(make-directory pub-dir t))
(or (equal (expand-file-name (file-name-directory filename))
(file-name-as-directory (expand-file-name pub-dir)))
(let ((dst-file (expand-file-name (file-name-nondirectory filename) pub-dir)))
(if (string-match-p ".*\\.\\(png\\|jpg\\|gif\\)$" filename)
(shell-command (format "~/.nix-profile/bin/convert %s -resize 800x800\\> +dither -colors 16 -depth 4 %s"
filename
dst-file))
(copy-file filename dst-file t)))))
(defalias 'org-blog-posts-sitemap-fn
(apply-partially 'org-blog-sitemap-fn-descr posts-descr))
(defun y/org-rss-publish-to-rss (plist filename pub-dir)
(if (equal "rss.org" (file-name-nondirectory filename))
(org-rss-publish-to-rss plist filename pub-dir)))
(defun y/format-rss-feed (title list)
(concat "#+TITLE: " title "\n"
"#+AUTHOR: " author-name "\n"
"#+EMAIL: " author-email "\n"
"#+DESCRIPTION: " rss-description "\n"
"\n"
(org-list-to-subtree list '(:icount "" :istart ""))))
(defun y/format-rss-feed-entry (entry style project)
(cond ((not (directory-name-p entry))
(let* ((file (org-publish--expand-file-name entry project))
(title (org-publish-find-title entry project))
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))
(link (concat domainname "/posts/" (file-name-sans-extension entry) ".html")))
(with-temp-buffer
(insert (format "* [[file:%s][%s]]\n" file title))
(org-set-property "RSS_PERMALINK" link)
(org-set-property "PUBDATE" date)
(org-set-property "ID" (org-auto-id-format title))
(buffer-string))))
((eq style 'tree)
(file-name-nondirectory (directory-file-name entry)))))
(setq org-publish-project-alist
`(("orgfiles"
:base-directory ,base-dir
:exclude ".*drafts/.*\\|.*/rss.*"
:base-extension "org"
:publishing-directory ,publish-dir
:recursive t
:publishing-function org-blog-publish-to-html
:with-toc nil
:with-title nil
:with-date t
:section-numbers nil
:html-doctype "html5"
:html-html5-fancy t
:html-head-include-default-style nil
:html-head-include-scripts nil
:htmlized-source t
:html-head-extra ,org-blog-head
:html-preamble org-blog-preamble
:html-postamble org-blog-postamble
:auto-sitemap t
:sitemap-filename "archive.org"
:sitemap-title "Articles"
:sitemap-style list
:sitemap-sort-files anti-chronologically
:sitemap-format-entry date-format-entry
:sitemap-function org-blog-posts-sitemap-fn)
("rss"
:base-directory ,posts-dir
:base-extension "org"
:recursive t
:publishing-directory ,publish-dir
:publishing-function y/org-rss-publish-to-rss
:rss-extension "xml"
:rss-image-url "https://her.esy.fun/img/FlatAvatar.png"
:auto-sitemap t
:sitemap-filename "rss.org"
:sitemap-title "her.esy.fun"
:sitemap-style list
:sitemap-function y/format-rss-feed
:sitemap-format-entry y/format-rss-feed-entry)
("assets"
:base-directory ,assets-dir
:base-extension ".*"
:exclude ".*\.org$"
:publishing-directory ,publish-assets-dir
:publishing-function org-blog-publish-attachment
:recursive t)
("blog" :components ("orgfiles" "assets"))))
;; add target=_blank and rel="noopener noreferrer" to all links by default
(defun my-org-export-add-target-blank-to-http-links (text backend info)
"Add target=\"_blank\" to external links."
(when (and
(org-export-derived-backend-p backend 'html)
(string-match "href=\"http[^\"]+" text)
(not (string-match "target=\"" text))
(not (string-match (concat "href=\"" domainname "[^\"]*") text)))
(string-match "<a " text)
(replace-match "<a target=\"_blank\" rel=\"noopener noreferrer\" " nil nil text)))
(add-to-list 'org-export-filter-link-functions
'my-org-export-add-target-blank-to-http-links)
(provide 'her-esy-fun-publish)

Binary file not shown.

View file

@ -1,8 +0,0 @@
#!/usr/bin/env zsh
for fic in src/**/*.{jpg,png,gif}(N.); do
tmp="temp.${fic:e}"
echo "$fic"
cp $fic $tmp
convert $tmp -resize 800x800\> $fic
rm $tmp
done

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
cd _site && sws -d --port 3001 .

33
shell.nix Normal file
View file

@ -0,0 +1,33 @@
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
haskellDeps = ps : with ps; [
protolude
turtle
ansi-terminal
];
ghc = pkgs.haskellPackages.ghcWithPackages haskellDeps;
in
pkgs.mkShell {
buildInputs = with pkgs;
[ cacert
coreutils
entr
pandoc
html-xml-utils # hxselect
zsh
perl
perlPackages.URI
minify
niv
git
direnv
ghc
tmux
libwebp
# for emacs dev
ripgrep
nodePackages.http-server
lighttpd
];
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

1
src/CNAME Normal file
View file

@ -0,0 +1 @@
yannesposito.com

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
pre code{color:#073642}code span.kw,code span a.kw{color:#859900;font-weight:normal;font-style:normal}code span.dt,code span a.dt{color:#B58900;font-weight:normal;font-style:normal}code span.dv,code span.bn,code span.fl,code span.ch,code span.st,code span a.dv,code span a.bn,code span a.fl,code span a.ch,code span a.st{color:#2AA198;font-weight:normal;font-style:normal}code span.co,code span a.co{color:#93A1A1;font-weight:normal;font-style:italic}code span.ot,code span a.ot{color:#268BD2;font-weight:normal;font-style:normal}code span.al,code span a.al{color:#DC322F;font-weight:normal;font-style:normal}code span.fu,code span a.fu{color:#268BD2;font-weight:normal;font-style:normal}code span.er,code span a.er{color:#DC322F;font-weight:normal;font-style:normal}code span.wa,code span a.wa{color:#CB4B16;font-weight:normal;font-style:italic}code span.cn,code span a.cn{color:#2AA198;font-weight:normal;font-style:normal}code span.sc,code span a.sc{color:#DC322F;font-weight:normal;font-style:normal}code span.vs,code span a.vs{color:#657B83;font-weight:normal;font-style:normal}code span.ss,code span a.ss{color:#DC322F;font-weight:normal;font-style:normal}code span.im,code span a.im{color:#657B83;font-weight:normal;font-style:normal}code span.va,code span a.va{color:#268BD2;font-weight:normal;font-style:normal}code span.cf,code span.op,code span a.cf,code span a.op{color:#859900;font-weight:normal;font-style:normal}code span.bu,code span.ex,code span a.bu,code span a.ex{color:#657B83;font-weight:normal;font-style:normal}code span.pp,code span a.pp{color:#CB4B16;font-weight:normal;font-style:normal}code span.at,code span a.at{color:#657B83;font-weight:normal;font-style:normal}code span.do,code span.an,code span.cv,code span.in,code span a.do,code span a.an,code span a.cv,code span a.in{color:#93A1A1;font-weight:normal;font-style:italic}a.sourceLine::before{text-decoration:none}

View file

@ -0,0 +1 @@
.hljs{background:#f3f4f5}pre{padding:.8em;background:#f3f4f5;color:#657b83;color:#839496;display:block}pre .high0{color:#586e75}pre .high,pre .high1{color:#073642}pre .high2{color:#002b36}pre .DiffInserted,pre .DiffChanged,pre .DiffHeader,pre .DiffDeleted,pre .EmbeddedSource,pre .EmbeddedSourceBright{color:#839496}pre .DiffHeader{font-style:italic}pre .EmbeddedSource,pre .EmbeddedSourceBright{background-color:#073642}pre .low,pre .line-numbers,pre .DoctypeXmlProcessing{color:#586e75}pre .Comment{color:#586e75;font-style:italic}pre .yellow,pre .CssClass,pre .CssPropertyName,pre .Entity,pre .MarkupList{color:#b58900}pre .EntityInheritedClass{color:#b58900;font-style:italic}pre .orange,pre .String,pre .StringRegexp,pre .StringEmbeddedSource,pre .StringConstant,pre .MetaTagAll{color:#cb4b16}pre .red{color:#dc322f}pre .InvalidIllegal,pre .CssAtRule,pre .InvalidDeprecated{color:#dc322f;font-style:italic}pre .magenta,pre .CCCPreprocessorLine,pre .CCCPreprocessorDirective{color:#d33682}pre .violet,pre .Constant{color:#6c71c4}pre .blue,pre .Storage,pre .Variable,pre .CssId,pre .SupportFunction,pre .MetaTagInline,pre .StringRegexpSpecial,pre .CssTagName,pre .StringVariable,pre .Support{color:#268bd2}pre .cyan,pre .MarkupHeading,pre .CssAdditionalConstants,pre .CssPropertyValue,pre .SupportConstant{color:#2aa198}pre .green,pre .CssPseudoClass,pre .Keyword,pre .CssConstructorArgument{color:#859900}pre code{color:#657b83;background-color:#f3f4f5}pre .comment,pre .template_comment,pre .diff .header,pre .doctype,pre .lisp .string,pre .javadoc{color:#93a1a1;font-style:italic}pre .keyword,pre .css .rule .keyword,pre .winutils,pre .javascript .title,pre .method,pre .addition,pre .css .tag,pre .lisp .title{color:#859900}pre .number,pre .command,pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula,pre .regexp,pre .hexcolor{color:#2aa198}pre .title,pre .localvars,pre .function .title,pre .chunk,pre .decorator,pre .builtin,pre .built_in,pre .lisp .title,pre .identifier,pre .title .keymethods,pre .id{color:#268bd2}pre .attribute,pre .variable,pre .instancevar,pre .lisp .body,pre .smalltalk .number,pre .constant,pre .class .title,pre .parent,pre .haskell .label{color:#b58900}pre .preprocessor,pre .pi,pre .shebang,pre .symbol,pre .diff .change,pre .special,pre .keymethods,pre .attr_selector,pre .important,pre .subst,pre .cdata{color:#cb4b16}pre .deletion{color:#dc322f}pre .tex .formula{background:#eee8d5}

View file

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - About</title>
<link rel="shortcut icon" type="image/x-icon" href="../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../../css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../pubkey.txt">
</head>
<body lang="en" class="default">
<div id="content">
<div id="header">
<div id="choix">
<div id="choixlang">
<a href="/about-me.html/">French</a>
</div>
<div class="flush"></div>
</div>
<div id="navigation">
<a href="../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
</div>
<div id="titre">
<h1>About</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="default">
<div class="corps">
<p><img src="../../../Scratch/img/about/FlatAvatar.png" alt="Avatar" class="clean left" /></p>
<p><strong>@</strong> <a href="mailto:yann.esposito@gmail.com">yann.esposito@gmail.com</a><br />
<a href="http://twitter.com/yogsototh"><span class="social">t</span> <span class="citation" data-cites="yogsototh">@yogsototh</span></a><br />
<a href="https://keybase.io/yogsototh"><img src="../../../Scratch/img/keybase.svg" style="height:16px" /> yogsototh</a><br />
<a href="http://pinboard.in/u:yogsototh"><img src="../../../Scratch/img/pinboard.png" class="simple" style="height: 16px" /> yogsototh</a><br />
<a href="http://github.com/yogsototh"><img src="../../../Scratch/img/GitHub-Mark-32px.png" class="simple" style="height: 16px" /> yogsototh</a><br />
<a href="http://stackoverflow.com/users/40569/yogsototh"><img src="../../../Scratch/img/stackoverflow-logo.png" class="simple" style="height: 16px" /> yogsototh</a></p>
<h2 id="shortly">Shortly</h2>
<p>I am a Senior Software Engineer (Clojurist) for <a href="http://cisco.com">Cisco</a>, Threatgrid team.</p>
<p>I was a Machine Learning expert and Software Engineer for Vigiglobe.</p>
<p>I tend to use functional programming a lot. Mostly <a href="http://haskell.org">Haskell</a> and <a href="http://clojure.org">Clo<i>j</i>ure</a>.</p>
<p>I am generally passionate about:</p>
<ul>
<li>Computer Science: <a href="http://yann.esposito.free.fr/recherche.php">Ive got a post Ph. D. degree in Computer Science</a>.</li>
<li>Programming: <a href="http://yann.esposito.free.fr/logiciels.php">I developed two scientific apps</a>, <a href="../../../Scratch/en/softwares">two Mac screen savers</a>, an <a href="http://ypassword.espozito.com">iOS app</a> and many other things; <a href="http://github.com/yogsototh">see my github</a></li>
<li>Computer Security: <a href="http://yann.esposito.free.fr/enseignement/rez0.php#projet">I designed a secure web protocol (similar to TOR)</a>, a method to securely remember strong passwords, (<a href="../../../Scratch/en/softwares/ypassword/">programmed a dashboard widget</a> and a shell script to use this method).</li>
</ul>
<p>But before all, I love to learn. For example, I learned many programming languages:</p>
<p>Functional:</p>
<ul>
<li><a href="http://haskell.org">Haskell</a>, <a href="http://purescript.org">Purescript</a>, <a href="http://elm-lang.org">Elm</a>,</li>
<li><a href="http://clojure.org">Clo<i>j</i>ure</a>, <a href="https://mitpress.mit.edu/sites/default/files/sicp/index.html">Scheme</a>,</li>
<li><a href="http://caml.inria.fr">camL</a></li>
</ul>
<p>Object Oriented:</p>
<ul>
<li>javascript, C, C++, Objective-C,</li>
<li>Java,</li>
<li><a href="http://python.org">Python</a>,</li>
<li><a href="http://ruby-lang.org">Ruby</a>,</li>
</ul>
<p>Also:</p>
<ul>
<li><a href="http://perl.org">Perl</a>,</li>
<li>awk,</li>
<li>bash,</li>
<li><a href="http://www.zsh.org">zsh</a>,</li>
<li><a href="http://www.latex-project.org"><span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">e</sub>X</span></a>,</li>
<li><a href="http://www.tug.org/metapost.html">metapost</a>,</li>
</ul>
<p><a href="/files/yann-esposito-resume.pdf">My full resume»</a></p>
<h2 id="old-stuff">Old stuff</h2>
<ul>
<li><a href="http://ypassword.espozito.com">Official YPassword website ✞</a></li>
<li><a href="http://yann.esposito.free.fr/recherche.php?css=blue&amp;lang=en">Research activities ✞</a></li>
<li><a href="http://yann.esposito.free.fr/">My student website ✞ 2007</a></li>
</ul>
</div>
<div id="afterarticle">
<div id="bottom">
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
Yann Esposito©
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><span class="strike">Vim</span></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><span class="strike">nanoc</span></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Nanoc</title>
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/01_nanoc/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Nanoc</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="what-is-nanoc">What is nanoc?</h1>
<p>It is not exactly a <abbr title="Content Management System">CMS</abbr>. But a Framework to generate static web pages.</p>
<p>You have to program yourself webpages, the code to generate the menu…</p>
<p>I added feature to make my website multilingual for example</p>
<p>Youll can find many informations on the <a href="http://nanoc.stoneship.org">official nanoc website</a>.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/01_nanoc/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/01_nanoc/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2008-10-10
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
(($#<1)) && { print 'usage: ack "regexp"' >&2; exit 1 }
listeFic=( **/*(.) )
autoload zargs
zargs -- $listeFic -- grep $1 | perl -ne 'use Term::ANSIColor;
if (m/([^:]*)(:.*)('$1')(.*)/) {
print color("green").$1;
print color("reset").$2;
print color("black","on_yellow").$3;
print color("reset").$4."\n";
} '

View file

@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Better than Grep</title>
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/02_ackgrep/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Better than Grep</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="update">update</h1>
<p>As <a href="http://www.theworkinggeek.com">Andy Lester</a> told me <a href="http://betterthangrep.com"><code>ack</code></a> is a simple file you only have to copy in your <code>~/bin</code> folder. Now Ive got <code>ack</code> on my professional server.</p>
<p>Go on <a href="http://betterthangrep.com">http://betterthangrep.com</a> to download it.</p>
<p>Sincerely, I dont understand <code>ack</code> dont become a common command on all UNIX systems. I can no more live without. For me it is as essential as <code>which</code> or <code>find</code>.</p>
<hr />
<h1 id="better-than-grep">Better than grep</h1>
<p>One of the my main usage of <code>grep</code> is</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">grep</span> <span class="st">'pattern'</span> **/*<span class="kw">(.)</span></a></code></pre></div>
<p>Most of time it is enough. But it is far better with colored output. <code>ack-grep</code> in Ubuntu does that. As I couldnt install it on my Evil Company Server, I had done one myself in very few lines:</p>
<pre><code>#!/usr/bin/env zsh
(($#&lt;1)) &amp;&amp; { print 'usage: ack &quot;regexp&quot;' &gt;&amp;2; exit 1 }
listeFic=( **/*(.) )
autoload zargs
zargs -- $listeFic -- grep $1 | perl -ne 'use Term::ANSIColor;
if (m/([^:]*)(:.*)('$1')(.*)/) {
print color(&quot;green&quot;).$1;
print color(&quot;reset&quot;).$2;
print color(&quot;black&quot;,&quot;on_yellow&quot;).$3;
print color(&quot;reset&quot;).$4.&quot;\n&quot;;
} '</code></pre>
<p>For my team and I it is usable enough. I hope it could help.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/02_ackgrep/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/02_ackgrep/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-07-22
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,173 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - A try to demystify 'Lost Highway'</title>
<meta name="keywords" content="movie, David Lynch, Lost Highway, alternate reality" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/03_losthighway/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>A try to demystify 'Lost Highway'</h1>
<h2>introduction</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div>
<img src="../../../../Scratch/img/blog/03_losthighway/intro.jpg" alt="Lost Highway" />
</div>
<div class="small">
<p>…this movie must be watched knowing youll cannot resolve the solution. At his best youll can suggest an interpretation close to the one of David Lynch.<br />I believe I had found a coherent interpretation which allow to follow the movie without being totally lost. I believed it can give the keys necessary to make its own idea of the movie…</p>
</div>
<p>Lost Higway is a really good movie. You keep watching it event it seem totally obscure. This is one of the strength of David Lynch.</p>
<p>The first time I watched Lost Highway, I was a bit lost. Here some of explanations of Lost Highway I found on the Internet:</p>
<ul>
<li>Fred make a pact with the devil incarnated by the <em>Mysterious Man</em>,</li>
<li><em>Mysterious Man</em> is a video camera,</li>
<li>Just the first part of the story is real. The rest is in the Freds imagination,</li>
</ul>
<p>and I dont speak about many point of view found in forums.</p>
<p>I finished to find two good site talking about this movie. But none of them still totally convinced me:</p>
<ul>
<li>the first is <a href="http://www.mediacircus.net/lh.html">mediacircus</a>,</li>
<li>the second which state almost the same interpretation about the movie and explain with even more details is on <a href="http://www.jasonsweb.com/LostHighway/main.htm">jasonweb</a></li>
</ul>
<p>Nonetheless, this movie must be watched knowing youll cannot resolve the solution. At his best youll can suggest an interpretation close to the one of David Lynch.</p>
<p>I believe I had found a coherent interpretation which allow to follow the movie <strong>without being totally lost</strong>. I believed it can give the keys necessary to make its own idea of the movie.</p>
<h2 id="the-rorschach-test">The Rorschach test</h2>
<div>
<img src="../../../../Scratch/img/blog/03_losthighway/rorschach.gif" alt="test de Rorschach" class="left" />
</div>
<p>Like the protagonist, everybody see what he want to see in this movie. It is an invitation to think. Watch this movie is a little like watch a Rorschachs test. What do we see in it? Everybody put its own personnality in the interpretation of the movie.</p>
<ul>
<li>If you are mystic, youll see in the mysterious man a devil,</li>
<li>If you are more psychanalytics, youll see an inconscient part of the protagonist…</li>
</ul>
<p>Generally, we stay in this movie and we fail explaining everything. There is almost always a point that dont fit within the interpretation of the movie. This is why trying to find a unique good interpretation of this movie is a mistake.</p>
<h2 id="interprétation-explanation">Interprétation ≠ Explanation</h2>
<p>I give an <strong>interpretation</strong> and not an <strong>explanation</strong>. Just to tell my vision of the movie should be very different from yours. There is certainly many coherent explanations.</p>
<p>I write this post because I believe I had found an interpretation which seems coherent for most of the movie.</p>
<h1 id="movies-keys">Movies keys</h1>
<div class="encadre" style="text-align: center">
<p><strong>All is in Freds memory</strong></p>
</div>
<p>In a first, it is clear for me, it is not a fantastic movie. If you follow this line, youll face many problem explaining some scenes.</p>
<p>My hypothesis is the movie describe the Freds representation of reality. Each of his tries to escape reality will fail.</p>
<p>Fred had commited an horrible act, a murder, and try to <em>repair</em> his memory to accepts it. Hell then create alternative realities.</p>
<ul>
<li>In a first time he kills his wife (Renee) because he believes she cheated at him.</li>
<li>In the second part, hes weaker and will be manipulated by the blond equivalent of Renee to kill Dick Laurent.</li>
<li>In a third part, he kills Dick Laurent</li>
</ul>
<h2 id="why-this-interpretation-can-be-valid">Why this interpretation can be valid?</h2>
<p>Because of the dialog at the begining of the movie. Cops ask Fred if hes own a video camera:</p>
<blockquote>
<p>“Do you own a video camera?”<br />
“No, Fred hates them.”<br />
“I like to remember things my own way.”<br />
“What do you mean by that?”<br />
“How I remember them, not necessarily the way they happened.”</p>
</blockquote>
<p>Then, what we see is not reality but the Freds perception. Fred is the God of the reality we see. This is why some God/Devil interpretation of the movie works not so bad.</p>
<h2 id="who-is-the-mysterious-man">Who is the mysterious man?</h2>
<div>
<img src="../../../../Scratch/img/blog/03_losthighway/mysteryman.jpg" alt=" " class="left" />
</div>
<p>Whos this mysterious man? He tells Fred its him who invited him in his house. Hes present at the party and in the house of Fred in the same time. Eyes wide open, looking everything Freds doing?</p>
<p>Its a key of the movie. In my humble opinion, I believe it represents the bad part of Fred. Certainly jalousy. If I was catholic, Ill said hes Satan. He observe, film but dont act. He helps Fred to kill Dick Laurent. Fred had let him enter and cannot let him go. As <em>Iago</em> of Shakespeare is imprisonned by its own jalousy. The Mysterious Man help Fred doing the acts of violence. It also force Fred to remember the reality.</p>
<p>When he makes love to his wife (Renee), he sees the face of the Mysterious Man instead of his wifes face. In reality, its the same person for Fred. It should be her whos the origin of his interior badness.</p>
<h2 id="whos-at-the-origin-of-the-video-tapes">Whos at the origin of the video tapes?</h2>
<p>Certainly its the mysterious man (Fred himself) who makes them. Their reason should be:</p>
<ul>
<li>Remember the reality to Fred. From Fred point-of-view, video tapes are the reality. He tries to forget reality. But, finally, the video tapes go to the end: the murder of his wife.</li>
<li>It may also be a reference to pornographic video tapes, made by Renee.</li>
</ul>
<h2 id="what-really-happened">What really happened?</h2>
<p>There is many possibilities here. But we have many indices. Here is a supposition.</p>
<h3 id="hypothesis">#1 Hypothesis</h3>
<p>The protagonist is a garagist fallen in love with a porno actress. He believe the producer is the bad guy who go again his will. Then he kills Dick Laurent.</p>
<h3 id="hypothesis-1">#2 Hypothesis</h3>
<p>He was really married, he had killed his wife. The the remorse let him create an alternate self, which live in a kind of perfect world. But after the time pass, his obsession about the murder came again. And nobody could know if he had killed Andy or not.</p>
<h2 id="which-one-then">which one then?</h2>
<p>The second hypothesis seems better. We can make much more interpretation with it. It explain in most part the strange phone call from Dick Laurent to Pete. But the first hypothesis remain coherent. And, we should probably make an in depth explanantion using the first hypothesis. And Im not sure it would be better.</p>
<p>One of the strength of this movie is to understand there is many other coherent hypothesis. It is an expression of the <a href="http://en.wikipedia.org/wiki/Rashomon_effect">Rashomon effect</a>. Many different persons could describe in a coherent manner what they saw. But each description contradicts the others.</p>
<hr />
<h2 id="conclusion">Conclusion</h2>
<p>There is much to tell about this movie. But I believe I put all essential keys here. It is a proof this movie is not a random one.</p>
<p>I believe it is essential to remember the “test of Rorschach effet” when watching this movie.</p>
<p>Id like to know or opinion ; is my interpration wrong?</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/03_losthighway/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/03_losthighway/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-08-04
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - DRM are EVIL</title>
<meta name="keywords" content="drm, protection, iTunes, Apple" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/04_drm/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>DRM are EVIL</h1>
<h2>DRM are bad (+1)</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="drm-are-evil-1">DRM are EVIL (+1)</h1>
<p>My wife bought about 500€ (at least) of TV Shows on iTunes. She bought the first season of Battlestar Gallactica in english (she notified the language after the dowload). DRM make it impossible to play it with french sub-titles.</p>
<div class="encadre">
<p style="text-align: center; font-size: 5em">
<strong>WTF?</strong>
</p>
</div>
<p>Result, my wife would never buy any TV show on iTunes. She dont like DVD because it is not as easy to buy and to use than to simply download episodes.</p>
<div class="encadre">
<p>Therefore far less money for you EVIL Copyrighter!!!!!</p>
</div>
<p>My wife wont see these episodes.<br /> This is a <strong>LOSE-LOSE</strong> cooperation.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/04_drm/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/04_drm/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-08-15
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
if (($#<1)); then
print -- "usage: $0:t branch_name" >&2
exit 1
fi
branch=$1
git br ${branch}
git co ${branch}
git config branch.${branch}.remote origin
git config branch.${branch}.merge refs/heads/${branch}

View file

@ -0,0 +1,106 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Git remote branch creation</title>
<meta name="keywords" content="git, branch, local, remote" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/05_git_create_remote_branch/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Git remote branch creation</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h2 id="easiest-remote-git-branch-creation">easiest remote Git branch creation</h2>
<p>I use git simply to synchronize stuff for personnal projects. Therefore, when I create a local branch I want most of time this branch to be created remotely.</p>
<p>Here is the script I use to achieve that:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="co">#!/usr/bin/env zsh</span></a>
<a class="sourceLine" id="cb1-2" title="2"></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="kw">if</span> <span class="kw">((</span><span class="ot">$#</span>&lt;1<span class="kw">))</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="kw">print</span> -- <span class="st">&quot;usage: </span><span class="ot">$0</span><span class="st">:t branch_name&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="kw">exit</span> 1</a>
<a class="sourceLine" id="cb1-6" title="6"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-7" title="7"></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="ot">branch=$1</span></a>
<a class="sourceLine" id="cb1-9" title="9">git br <span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb1-10" title="10">git <span class="kw">co</span> <span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb1-11" title="11">git config branch.<span class="ot">${branch}</span>.remote origin</a>
<a class="sourceLine" id="cb1-12" title="12">git config branch.<span class="ot">${branch}</span>.merge refs/heads/<span class="ot">${branch}</span></a></code></pre></div>
<p>Of course, I suppose <code>origin</code> is already configured.</p>
<p><em>Edit: Now I use <code>git push -u</code></em></p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/05_git_create_remote_branch/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/05_git_create_remote_branch/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-08-17
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
if (($#<1)); then
print -- "usage: $0:t branch_name" >&2
exit 1
fi
branch=$1
git br ${branch}
git co ${branch}
git config branch.${branch}.remote origin
git config branch.${branch}.merge refs/heads/${branch}

View file

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
# recup branches not on local
localbranches=( $(git br | sed 's/\*/ /') )
remoteMissingBranches=( $(git br -r | \
egrep -v "origin/HEAD|(${(j:|:)localbranches})" ) )
for br in $remoteMissingBranches; do
branch=${br#origin/}
print "get remote branch $branch"
git br ${branch}
git config branch.${branch}.remote origin
git config branch.${branch}.merge refs/heads/${branch}
done

View file

@ -0,0 +1,197 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Git for self</title>
<meta name="keywords" content="git, svn, workflow" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/06_How_I_use_git/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Git for self</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div>
<img src="../../../../Scratch/img/blog/06_How_I_use_git/central_architecture.png" alt="central architecture" />
</div>
<p>I use <a href="http://www.git-scm.org/">Git</a> to manage my personnal projects. I have a centralized repository which all my computer should synchronize with. Unfortunately I didnt find clearly what I needed on the official Git documentation.</p>
<p>In two words, if you want to use an SVN workflow with Git (and all its advantages) here is how to proceed.</p>
<hr />
<h2 id="initialisation">Initialisation</h2>
<p>Suppose Ive got a directory on my local computer containing a project I want to manage via Git. Here what to do:</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">cd</span> to/project/directory/</a>
<a class="sourceLine" id="cb1-2" title="2">git init</a>
<a class="sourceLine" id="cb1-3" title="3">git add</a>
<a class="sourceLine" id="cb1-4" title="4">git commit</a></code></pre></div>
</div>
<p>Now all files in the <code>to/project/directory/</code> are versionned. If you want not to follow some just edit the file <code>.gitignore</code></p>
<p>for example mine is:</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb2-1" title="1">*.swp</a>
<a class="sourceLine" id="cb2-2" title="2">.DS_Store</a>
<a class="sourceLine" id="cb2-3" title="3">ikog.py.bak</a>
<a class="sourceLine" id="cb2-4" title="4">output/Scratch/assets</a>
<a class="sourceLine" id="cb2-5" title="5">output/Scratch/en</a>
<a class="sourceLine" id="cb2-6" title="6">output/Scratch/fr</a>
<a class="sourceLine" id="cb2-7" title="7">output/Scratch/multi</a></code></pre></div>
</div>
<p>Next, you want to put your project on a directory accessible from the web:</p>
<div>
<div class="sourceCode" id="cb3"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb3-1" title="1">git <span class="kw">clone</span> --bare <span class="kw">.</span> /path/to/repository</a></code></pre></div>
</div>
<p>Now on any computer you can do:</p>
<div>
<div class="sourceCode" id="cb4"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb4-1" title="1">git <span class="kw">clone</span> protocol://path/to/repository local_directory</a></code></pre></div>
</div>
<p>and <code>local_directory</code> will contain an up-to-date project.</p>
<div class="encadre">
<p><em> You should make this operation also on the computer used to create the repository. Just to verify all will be okay.</p>
<p></em></p>
</div>
<hr />
<h2 id="the-workflow">The workflow</h2>
<p>To resume you now have one repository on the Internet, and one or many computer associated with it. Now, what you want is to synchronize everything.</p>
<p>Before begining your work, the first thing to do is to get all modification from the Internet to your local host:</p>
<div>
<div class="sourceCode" id="cb5"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb5-1" title="1">git pull</a></code></pre></div>
</div>
<p>After that you can do (many times):</p>
<div>
<div class="sourceCode" id="cb6"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb6-1" title="1">hack, hack, hack...</a>
<a class="sourceLine" id="cb6-2" title="2">git add some files</a>
<a class="sourceLine" id="cb6-3" title="3">git commit</a></code></pre></div>
</div>
<p>When you want your local modification to be on the Internet just do a simple:</p>
<div>
<div class="sourceCode" id="cb7"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb7-1" title="1">git push</a></code></pre></div>
</div>
<p>All should be ok.</p>
<p>If you have some trouble with the <code>push</code> and <code>pull</code> verify your <code>.git/config</code> file ; it should contain the following lines:</p>
<div>
<div class="sourceCode" id="cb8"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb8-1" title="1">...</a>
<a class="sourceLine" id="cb8-2" title="2">[remote <span class="st">&quot;origin&quot;</span>]</a>
<a class="sourceLine" id="cb8-3" title="3"> url = protocol://url/of/the/repository</a>
<a class="sourceLine" id="cb8-4" title="4"> fetch = +refs/heads/*:refs/remotes/origin/*</a>
<a class="sourceLine" id="cb8-5" title="5">[branch <span class="st">&quot;master&quot;</span>]</a>
<a class="sourceLine" id="cb8-6" title="6"> remote = origin</a>
<a class="sourceLine" id="cb8-7" title="7"> merge = refs/heads/master</a>
<a class="sourceLine" id="cb8-8" title="8">...</a></code></pre></div>
</div>
<h2 id="branches-synchronisation">Branches Synchronisation</h2>
<p>Well, now, all seems ok, but you have to worry about two little things. Git is all about decentralisation and branches. It is very easy to manage one branch, or many branches on the same host. But synchronize branches on many hosts is not a natural operation.</p>
<p>This is why I created two simple scripts to automate this. One for creating a branch locally and remotely. And one to get remotely created branched on your local host.</p>
<p>Then when you want to create a new branch (locally and remotely) ; you simply have to do a:</p>
<div>
<code class="zsh">git-create-new-branch branch_name</code>
</div>
<p>and when you are on another computer and want to get locally all the remote branches you execute:</p>
<div>
<code class="zsh">git-get-remote-branches</code>
</div>
<p>Here are the code of theese two scripts:</p>
<div>
<div class="sourceCode" id="cb9"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb9-1" title="1"><span class="co">#!/usr/bin/env zsh</span></a>
<a class="sourceLine" id="cb9-2" title="2"></a>
<a class="sourceLine" id="cb9-3" title="3"><span class="kw">if</span> <span class="kw">((</span><span class="ot">$#</span>&lt;1<span class="kw">))</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb9-4" title="4"> <span class="kw">print</span> -- <span class="st">&quot;usage: </span><span class="ot">$0</span><span class="st">:t branch_name&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb9-5" title="5"> <span class="kw">exit</span> 1</a>
<a class="sourceLine" id="cb9-6" title="6"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb9-7" title="7"></a>
<a class="sourceLine" id="cb9-8" title="8"><span class="ot">branch=$1</span></a>
<a class="sourceLine" id="cb9-9" title="9">git br <span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb9-10" title="10">git <span class="kw">co</span> <span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb9-11" title="11">git config branch.<span class="ot">${branch}</span>.remote origin</a>
<a class="sourceLine" id="cb9-12" title="12">git config branch.<span class="ot">${branch}</span>.merge refs/heads/<span class="ot">${branch}</span></a></code></pre></div>
</div>
<div>
<div class="sourceCode" id="cb10"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb10-1" title="1"><span class="co">#!/usr/bin/env zsh</span></a>
<a class="sourceLine" id="cb10-2" title="2"></a>
<a class="sourceLine" id="cb10-3" title="3"><span class="co"># recup branches not on local</span></a>
<a class="sourceLine" id="cb10-4" title="4"><span class="ot">localbranches=(</span> <span class="ot">$(</span>git br <span class="kw">|</span> <span class="kw">sed</span> <span class="st">'s/\*/ /'</span><span class="ot">)</span> <span class="ot">)</span></a>
<a class="sourceLine" id="cb10-5" title="5"><span class="ot">remoteMissingBranches=(</span> <span class="ot">$(</span>git br -r <span class="kw">|</span> <span class="kw">\</span></a>
<a class="sourceLine" id="cb10-6" title="6"> <span class="kw">egrep</span> -v <span class="st">&quot;origin/HEAD|(${(j:|:)localbranches})&quot;</span> <span class="ot">)</span> <span class="ot">)</span></a>
<a class="sourceLine" id="cb10-7" title="7"><span class="kw">for</span> br <span class="kw">in</span> <span class="ot">$remoteMissingBranches</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb10-8" title="8"> <span class="ot">branch=${br#</span>origin/<span class="ot">}</span></a>
<a class="sourceLine" id="cb10-9" title="9"> <span class="kw">print</span> <span class="st">&quot;get remote branch </span><span class="ot">$branch</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb10-10" title="10"> git br <span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb10-11" title="11"> git config branch.<span class="ot">${branch}</span>.remote origin</a>
<a class="sourceLine" id="cb10-12" title="12"> git config branch.<span class="ot">${branch}</span>.merge refs/heads/<span class="ot">${branch}</span></a>
<a class="sourceLine" id="cb10-13" title="13"><span class="kw">done</span></a></code></pre></div>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/06_How_I_use_git/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/06_How_I_use_git/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-08-18
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Screensaver compilation option for Snow Leopard<sub>&copy;</sub></title>
<meta name="keywords" content="screensaver, Apple, mac, Xcode" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/07_Screensaver_compilation_option_for_Snow_Leopard/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Screensaver compilation option for Snow Leopard<sub>&copy;</sub></h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="how-to-recompile-your-screensaver-to-be-snow-leopardc-compatible">How to recompile your screensaver to be Snow Leopard(c) compatible</h1>
<p>I upgraded to Mac OS X 10.6 Snow Leopard(c), and my <a href="../../../../Scratch/en/softwares/yclock/">YClock</a> screensaver didnt work on it. After searching on google, the problem seems to be just a recompilation away. Unfortunately, even recompiling it in 64 bit it didnt work either. After a bit more research (thanks to <a href="http://community.electricsheep.org/node/236">ElectricSheep</a> ).</p>
<p>I discovered the good parameters for compilation.</p>
<div>
<img src="../../../../Scratch/img/blog/07_Screensaver_compilation_option_for_Snow_Leopard/xcodeConfig.png" alt="XCode configuration" />
</div>
<p>For now I didnt compiled it to work also on Tiger and Leopard. I dont know XCode enought to know how to make the Garbage collector to be disabled on 32 bits version and enabled on 64 bits version.</p>
<p>It was a bit difficult to discover these informations. Hope this post helped someone.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/07_Screensaver_compilation_option_for_Snow_Leopard/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/07_Screensaver_compilation_option_for_Snow_Leopard/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-06
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>local.sshd</string>
<key>Program</key>
<string>/usr/libexec/sshd-keygen-wrapper</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sshd</string>
<string>-i</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>https</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
</plist>

View file

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - ssh to Listen 443 on Snow Leopard</title>
<meta name="keywords" content="Apple, mac, ssh, security" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>ssh to Listen 443 on Snow Leopard</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="surf-everywhere-as-if-you-were-at-home">Surf everywhere as if you were at home</h1>
<p>In order to bypass <em>evil</em> company firewall and to surf safely on unsafe <sc>wifi</sc>. I keep an ssh server listening on the port 443.</p>
<p>Then from my laptop or my local computer I just have to launch the marvelous</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">ssh</span> -f -p 443 -ND 9050 username@host</a></code></pre></div>
</div>
<p>and a local <sc>socks</sc> proxy listening on port 9050 is launched. The <sc>socks</sc> proxy will transfer local requests via the ssh tunnel. Therefore I can surf locally as if I was on my own computer. I can put password and card number without fear the local <sc>wifi</sc> network to be <em>sniffed</em>. I simply need to configure my web browser to user the <sc>socks</sc> proxy on localhost and port 9050.</p>
<p>I get this information from <a href="http://dltj.org/article/ssh-as-socks-proxy/">this post</a>.</p>
<h1 id="ssh-and-snow-leopardc">Ssh and Snow Leopard(c)</h1>
<p>Here I dont want to talk about how great <sc>socks</sc> proxy via ssh tunneling is but how to configure my local server.</p>
<p>I have Mac with Snow Leopard(c) at home and it is far from enough to modify the <code>/etc/sshd.config</code> file. The system use <code>launchd</code> to launch starting daemons.</p>
<p>I posted the question on <a href="http://discussions.apple.com">Apple Discussions</a> in this <a href="http://discussions.apple.com/thread.jspa?messageID=10141032">discussion thread</a>. Thanks to all guys who helped me. And the solution is:</p>
<p>Create the file <tt>/Library/LaunchDaemons/ssh-443.plist</tt> containing:</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span class="kw">?&gt;</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="dt">&lt;!DOCTYPE </span>plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;<span class="dt">&gt;</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="kw">&lt;plist</span><span class="ot"> version=</span><span class="st">&quot;1.0&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="kw">&lt;dict&gt;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">&lt;key&gt;</span>Disabled<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">&lt;false/&gt;</span></a>
<a class="sourceLine" id="cb2-7" title="7"> <span class="kw">&lt;key&gt;</span>Label<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="kw">&lt;string&gt;</span>local.sshd<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">&lt;key&gt;</span>Program<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-10" title="10"> <span class="kw">&lt;string&gt;</span>/usr/libexec/sshd-keygen-wrapper<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-11" title="11"> <span class="kw">&lt;key&gt;</span>ProgramArguments<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-12" title="12"> <span class="kw">&lt;array&gt;</span></a>
<a class="sourceLine" id="cb2-13" title="13"> <span class="kw">&lt;string&gt;</span>/usr/sbin/sshd<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-14" title="14"> <span class="kw">&lt;string&gt;</span>-i<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-15" title="15"> <span class="kw">&lt;/array&gt;</span></a>
<a class="sourceLine" id="cb2-16" title="16"> <span class="kw">&lt;key&gt;</span>Sockets<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-17" title="17"> <span class="kw">&lt;dict&gt;</span></a>
<a class="sourceLine" id="cb2-18" title="18"> <span class="kw">&lt;key&gt;</span>Listeners<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-19" title="19"> <span class="kw">&lt;dict&gt;</span></a>
<a class="sourceLine" id="cb2-20" title="20"> <span class="kw">&lt;key&gt;</span>SockServiceName<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-21" title="21"> <span class="kw">&lt;string&gt;</span>https<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-22" title="22"> <span class="kw">&lt;/dict&gt;</span></a>
<a class="sourceLine" id="cb2-23" title="23"> <span class="kw">&lt;/dict&gt;</span></a>
<a class="sourceLine" id="cb2-24" title="24"> <span class="kw">&lt;key&gt;</span>inetdCompatibility<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-25" title="25"> <span class="kw">&lt;dict&gt;</span></a>
<a class="sourceLine" id="cb2-26" title="26"> <span class="kw">&lt;key&gt;</span>Wait<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-27" title="27"> <span class="kw">&lt;false/&gt;</span></a>
<a class="sourceLine" id="cb2-28" title="28"> <span class="kw">&lt;/dict&gt;</span></a>
<a class="sourceLine" id="cb2-29" title="29"> <span class="kw">&lt;key&gt;</span>StandardErrorPath<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-30" title="30"> <span class="kw">&lt;string&gt;</span>/dev/null<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-31" title="31"> <span class="kw">&lt;key&gt;</span>SHAuthorizationRight<span class="kw">&lt;/key&gt;</span></a>
<a class="sourceLine" id="cb2-32" title="32"> <span class="kw">&lt;string&gt;</span>system.preferences<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb2-33" title="33"><span class="kw">&lt;/dict&gt;</span></a>
<a class="sourceLine" id="cb2-34" title="34"><span class="kw">&lt;/plist&gt;</span></a></code></pre></div>
</div>
<p>It is a copy of <code>/System/Library/LaunchDaemons/ssh.plist</code> with some modifications:</p>
<ul>
<li>the <code>SockServiceName</code> from <code>ssh</code> to <code>https</code>.</li>
<li>the <code>Label</code> from <code>com.openssh.sshd</code> to something not existing as <code>local.sshd</code></li>
</ul>
<p>Tell me if it was helpfull or if you have any question.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-07
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Why I didn't keep whos.amung.us</title>
<meta name="keywords" content="analytics, web" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/09_Why_I_didn-t_keep_whosamung-us/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Why I didn't keep whos.amung.us</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I changed from <a href="http://whos.amung.us">whos.amung.us</a> to <a href="http://www.google.com/analytics">Google Analytics</a>.</p>
<p>Most of time I prefer not to use the same product as everybody and try some new. But this time I believe whosamung.us had too much ads on the page. I had to put their image on my website and they only give then number of user currently on the website, not the number of visits.</p>
<p>This is why I now use google analytics. The only problem, remains for pages with no javascript support.</p>
<p>Then for now:</p>
<div class="encadre">
Theorem:<br />
<center>
Google Analytics <big><strong>&gt;</strong></big> Whos Amung Us
<center>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/09_Why_I_didn-t_keep_whosamung-us/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/09_Why_I_didn-t_keep_whosamung-us/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-11
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
#!/usr/bin/env zsh
# Author: Yann Esposito
# Mail: yann.esposito@gmail.com
# Synchronize with "mobileMe" iDisk account.
mobileMeUser="firstname.lastname"
siteName="siteName"
# Depending of my hostname the
if [[ $(hostname) == 'ubuntu' ]]; then
iDisk='/mnt/iDisk'
else
iDisk="/Volumes/$mobileMeUser"
fi
root=$HOME/Sites/$siteName
destRep=$iDisk/Web/Sites/$siteName
[[ ! -d $root ]] && {
print -- "$root does not exist ; please verify the configuration ($0)" >&2;
exit 1
}
[[ ! -d $destRep ]] && {
print -- "$destRep does not exist, please mount the filesystem" >&2;
exit 1
}
if [[ $1 == '-h' ]]; then
print -- "usage: $0:h [-h|-a|-s]"
print -- " -a sychronize primary index"
print -- " -h show this help"
print -- " -s only swap directories"
fi
if [[ $1 == '-a' ]]; then
print -- "Index synchronisation (${destRep:h})"
rsync -av $root/index.html ${destRep:h}/index.html
fi
print -- "Root = $root"
print -- "Dest = $destRep"
if [[ ! $1 = '-s' ]]; then
[[ ! -d $destRep.tmp ]] && mkdir $destRep.tmp
print -P -- "%B[Sync => tmp]%b"
result=1
essai=1
while (( $result > 0 )); do
rsync -arv $root/Scratch/ $destRep.tmp
result=$?
if (( $result > 0 )); then
print -P -- "%Brsync failed%b (try n°$essai)" >&2
fi
((essai++))
done
fi
# SWAP
print -P -- "%B[Directory Swap (tmp <=> target)]%b"
essai=1
while [[ -e $destRep.old ]]; do
print -n -- "remove $destRep.old"
if ((essai>1)); then
print " (try n°$essai)"
else
print
fi
((essai++))
\rm -rf $destRep.old
done
print -- " renommage du repertoire sandard vers le .old"
essai=1
while [[ -e $destRep ]]; do
mv $destRep $destRep.old
(($?)) && print -- "Failed to rename (try n°$essai)" >&2
((essai++))
done
print -- " renaming folder tmp (new) to the standard one"
print -P -- " %BThe WebSite isn't working%b $(date)"
essai=1
while [[ ! -e $destRep ]]; do
mv $destRep.tmp $destRep
(($?)) && print -P -- "%B[WebSite not working]%b(try n°$essai) Failed to rename (mv $destRep.tmp $destRep)" >&2
((essai++))
done
print -P -- "\t===\t%BWEBSITE SHOULD WORK NOW%b\t==="
print -- " rename old folder to tmp folder"
essai=1
while [[ ! -e $destRep ]]; do
mv $destRep.old $destRep.tmp
(($?)) && print -P -- "Failed to rename n°$essai" >&2
((essai++))
done
print -P -- " Publish terminated"

View file

@ -0,0 +1,315 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Synchronize Custom WebSite with mobileMe</title>
<meta name="keywords" content="Apple, mobileme, WebDav, synchronisation, zsh, script" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/10_Synchronize_Custom_WebSite_with_mobileMe/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Synchronize Custom WebSite with mobileMe</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="update-20120111">Update <small>(2012/01/11)</small></h1>
<p>iDisk should soon disapear. This entry is mainly obsolescent now.</p>
<h1 id="update-20091028">Update <small>(2009/10/28)</small></h1>
<p>I <a href="../../../../Scratch/en/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-">updated my script</a> which is now incremental. Since the writing of this article, Apple(c) had made many efforts about the bandwith of its European servers.</p>
<hr />
<h1 id="webdav-terror">WebDav terror</h1>
<p>I live in France and iDisk upload is just terrible. Upload speed remind me the old 56k modem. Most operations such as list the content of a directory take at least 30 seconds (for 15 elements). Renaming a directory fail most of time.</p>
<p>Apple(c) use a WebDav server to host files. It works on port 80 (like http). I realized WebDav via https work better (2 to 3 times faster with far less errors). But even https is too slow.</p>
<p>I upload from my Mac and sometimes from an Ubuntu PC (iDisk mounted with webdavfs).</p>
<h1 id="synchronize-safely-the-website">Synchronize safely the website</h1>
<p>Here is the script I use in order to synchronize my website with maximum safety. It try each operations until it works.</p>
<p>The idea are:</p>
<ul>
<li>synchronize to a temporary folder then swap the name therefore the website isnt accessible only during the swap time. It takes only the time of two rename.</li>
<li>reiterate all operations until they work (for example, renaming).</li>
</ul>
<p>For now I use <code>rsync</code> which in fact is no more efficient than a simple <code>cp</code> with WebDav. And I should use a method to keep track of elements who have changed. before the publication.</p>
<p>In fact when Im on a Mac, I use <a href="http://www.panic.com/transmit">Transmit</a> which is very cool and far more efficient than the Finder to synchronize files. After the synchronization, I swap the directories.</p>
<p>My script take a <code>-s</code> option in order to make only the swap option. It also take a <code>-a</code> in order to put the new <code>index.html</code> which should point to the new homepage (not the iWeb one).</p>
<p>In order to keep this script working for you, just modify the username by yours (the value of the <code>mobileMeUser</code>).</p>
<div class="fr">
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="co">#!/usr/bin/env zsh</span></a>
<a class="sourceLine" id="cb1-2" title="2"></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="co"># Script synchronisant le site sur me.com</span></a>
<a class="sourceLine" id="cb1-4" title="4"><span class="co"># normalement, le site est indisponible le moins de temps possible</span></a>
<a class="sourceLine" id="cb1-5" title="5"><span class="co"># le temps de deux renommages de répertoire</span></a>
<a class="sourceLine" id="cb1-6" title="6"></a>
<a class="sourceLine" id="cb1-7" title="7"><span class="ot">mobileMeUser=</span><span class="st">&quot;yann.esposito&quot;</span></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="ot">siteName=</span><span class="st">&quot;siteName&quot;</span></a>
<a class="sourceLine" id="cb1-9" title="9"></a>
<a class="sourceLine" id="cb1-10" title="10"><span class="co"># Depending of my hostname the </span></a>
<a class="sourceLine" id="cb1-11" title="11"><span class="kw">if [[</span> <span class="ot">$(</span><span class="kw">hostname</span><span class="ot">)</span> <span class="ot">==</span> <span class="st">'ubuntu'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-12" title="12"> <span class="ot">iDisk=</span><span class="st">'/mnt/iDisk'</span></a>
<a class="sourceLine" id="cb1-13" title="13"><span class="kw">else</span></a>
<a class="sourceLine" id="cb1-14" title="14"> <span class="ot">iDisk=</span><span class="st">&quot;/Volumes/</span><span class="ot">$mobileMeUser</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb1-15" title="15"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-16" title="16"></a>
<a class="sourceLine" id="cb1-17" title="17"><span class="ot">root=$HOME</span>/Sites/<span class="ot">$siteName</span></a>
<a class="sourceLine" id="cb1-18" title="18"><span class="ot">destRep=$iDisk</span>/Web/Sites/<span class="ot">$siteName</span></a>
<a class="sourceLine" id="cb1-19" title="19"></a>
<a class="sourceLine" id="cb1-20" title="20"><span class="kw">[[</span> <span class="ot">!</span> <span class="ot">-d</span> <span class="ot">$root</span><span class="kw"> ]]</span> <span class="kw">&amp;&amp;</span> <span class="kw">{</span> </a>
<a class="sourceLine" id="cb1-21" title="21"> <span class="kw">print</span> -- <span class="st">&quot;</span><span class="ot">$root</span><span class="st"> n'existe pas ; vérifiez la conf&quot;</span> <span class="kw">&gt;&amp;2</span>; </a>
<a class="sourceLine" id="cb1-22" title="22"> <span class="kw">exit</span> 1 </a>
<a class="sourceLine" id="cb1-23" title="23"><span class="kw">}</span></a>
<a class="sourceLine" id="cb1-24" title="24"></a>
<a class="sourceLine" id="cb1-25" title="25"><span class="kw">[[</span> <span class="ot">!</span> <span class="ot">-d</span> <span class="ot">$destRep</span><span class="kw"> ]]</span> <span class="kw">&amp;&amp;</span> <span class="kw">{</span> </a>
<a class="sourceLine" id="cb1-26" title="26"> <span class="kw">print</span> -- <span class="st">&quot;</span><span class="ot">$destRep</span><span class="st"> n'existe pas, veuillez remonter le FS&quot;</span> <span class="kw">&gt;&amp;2</span>; </a>
<a class="sourceLine" id="cb1-27" title="27"> <span class="kw">exit</span> 1 </a>
<a class="sourceLine" id="cb1-28" title="28"><span class="kw">}</span></a>
<a class="sourceLine" id="cb1-29" title="29"></a>
<a class="sourceLine" id="cb1-30" title="30"><span class="kw">if [[</span> <span class="ot">$1</span> <span class="ot">==</span> <span class="st">'-h'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-31" title="31"> <span class="kw">print</span> -- <span class="st">&quot;usage: </span><span class="ot">$0</span><span class="st">:h [-h|-a|-s]&quot;</span></a>
<a class="sourceLine" id="cb1-32" title="32"> <span class="kw">print</span> -- <span class="st">&quot; -a sychronise aussi l'index&quot;</span></a>
<a class="sourceLine" id="cb1-33" title="33"> <span class="kw">print</span> -- <span class="st">&quot; -h affiche l'aide&quot;</span></a>
<a class="sourceLine" id="cb1-34" title="34"> <span class="kw">print</span> -- <span class="st">&quot; -s swappe simplement les répertoires&quot;</span></a>
<a class="sourceLine" id="cb1-35" title="35"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-36" title="36"></a>
<a class="sourceLine" id="cb1-37" title="37"><span class="kw">if [[</span> <span class="ot">$1</span> <span class="ot">==</span> <span class="st">'-a'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-38" title="38"> <span class="kw">print</span> -- <span class="st">&quot;Synchronisation de l'index (</span><span class="ot">${destRep:h}</span><span class="st">)&quot;</span></a>
<a class="sourceLine" id="cb1-39" title="39"> rsync -av <span class="ot">$root</span>/index.html <span class="ot">${destRep:h}</span>/index.html</a>
<a class="sourceLine" id="cb1-40" title="40"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-41" title="41"></a>
<a class="sourceLine" id="cb1-42" title="42"><span class="kw">print</span> -- <span class="st">&quot;Root = </span><span class="ot">$root</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb1-43" title="43"><span class="kw">print</span> -- <span class="st">&quot;Dest = </span><span class="ot">$destRep</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb1-44" title="44"></a>
<a class="sourceLine" id="cb1-45" title="45"><span class="kw">if [[</span> <span class="ot">!</span> <span class="ot">$1</span> <span class="ot">=</span> <span class="st">'-s'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-46" title="46"> [[ ! -d <span class="ot">$destRep</span>.tmp ]] <span class="kw">&amp;&amp;</span> <span class="kw">mkdir</span> <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb1-47" title="47"> <span class="kw">print</span> -P -- <span class="st">&quot;%B[Sync =&gt; tmp]%b&quot;</span></a>
<a class="sourceLine" id="cb1-48" title="48"> <span class="ot">result=</span>1</a>
<a class="sourceLine" id="cb1-49" title="49"> <span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb1-50" title="50"> <span class="kw">while</span> <span class="kw">((</span> <span class="ot">$result</span> &gt; 0 <span class="kw">))</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb1-51" title="51"> rsync -arv <span class="ot">$root</span>/Scratch/ <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb1-52" title="52"> <span class="ot">result=$?</span></a>
<a class="sourceLine" id="cb1-53" title="53"> <span class="kw">if</span> <span class="kw">((</span> <span class="ot">$result</span> &gt; 0 <span class="kw">))</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb1-54" title="54"> <span class="kw">print</span> -P -- <span class="st">&quot;%BEchec du rsync%b (essai n°</span><span class="ot">$essai</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb1-55" title="55"> <span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-56" title="56"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb1-57" title="57"> <span class="kw">done</span></a>
<a class="sourceLine" id="cb1-58" title="58"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-59" title="59"></a>
<a class="sourceLine" id="cb1-60" title="60"><span class="co"># SWAP</span></a>
<a class="sourceLine" id="cb1-61" title="61"><span class="kw">print</span> -P -- <span class="st">&quot;%B[Swap des Répertoires (tmp &lt;=&gt; target)]%b&quot;</span></a>
<a class="sourceLine" id="cb1-62" title="62"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb1-63" title="63"><span class="kw">while [[</span> <span class="ot">-e</span> <span class="ot">$destRep</span>.old<span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb1-64" title="64"> <span class="kw">print</span> -n -- <span class="st">&quot;suppression de </span><span class="ot">$destRep</span><span class="st">.old&quot;</span></a>
<a class="sourceLine" id="cb1-65" title="65"> <span class="kw">if</span> <span class="kw">((</span>essai&gt;1<span class="kw">))</span>; <span class="kw">then</span> </a>
<a class="sourceLine" id="cb1-66" title="66"> <span class="kw">print</span> <span class="st">&quot; (essai n°</span><span class="ot">$essai</span><span class="st">)&quot;</span></a>
<a class="sourceLine" id="cb1-67" title="67"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb1-68" title="68"> <span class="kw">print</span></a>
<a class="sourceLine" id="cb1-69" title="69"> <span class="kw">fi</span></a>
<a class="sourceLine" id="cb1-70" title="70"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb1-71" title="71"> \<span class="kw">rm</span> -rf <span class="ot">$destRep</span>.old</a>
<a class="sourceLine" id="cb1-72" title="72"><span class="kw">done</span></a>
<a class="sourceLine" id="cb1-73" title="73"></a>
<a class="sourceLine" id="cb1-74" title="74"><span class="kw">print</span> -- <span class="st">&quot; renommage du repertoire sandard vers le .old&quot;</span></a>
<a class="sourceLine" id="cb1-75" title="75"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb1-76" title="76"><span class="kw">while [[</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb1-77" title="77"> <span class="kw">mv</span> <span class="ot">$destRep</span> <span class="ot">$destRep</span>.old </a>
<a class="sourceLine" id="cb1-78" title="78"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -- <span class="st">&quot;Echec du renommage (essai n°</span><span class="ot">$essai</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb1-79" title="79"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb1-80" title="80"><span class="kw">done</span></a>
<a class="sourceLine" id="cb1-81" title="81"></a>
<a class="sourceLine" id="cb1-82" title="82"><span class="kw">print</span> -- <span class="st">&quot; renommage du repertoire tmp (nouveau) vers le standard&quot;</span></a>
<a class="sourceLine" id="cb1-83" title="83"><span class="kw">print</span> -P -- <span class="st">&quot; %BSite Indisponible%b </span><span class="ot">$(</span><span class="kw">date</span><span class="ot">)</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb1-84" title="84"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb1-85" title="85"><span class="kw">while [[</span> <span class="ot">!</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb1-86" title="86"> <span class="kw">mv</span> <span class="ot">$destRep</span>.tmp <span class="ot">$destRep</span></a>
<a class="sourceLine" id="cb1-87" title="87"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -P -- <span class="st">&quot;%B[Site Indisponible]%b(essai n°</span><span class="ot">$essai</span><span class="st">) Echec du renommage (mv </span><span class="ot">$destRep</span><span class="st">.tmp </span><span class="ot">$destRep</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb1-88" title="88"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb1-89" title="89"><span class="kw">done</span></a>
<a class="sourceLine" id="cb1-90" title="90"></a>
<a class="sourceLine" id="cb1-91" title="91"><span class="kw">print</span> -P -- <span class="st">&quot;\t===\t%BSITE DISPONIBLE%b\t===&quot;</span></a>
<a class="sourceLine" id="cb1-92" title="92"></a>
<a class="sourceLine" id="cb1-93" title="93"><span class="kw">print</span> -- <span class="st">&quot; renommage du repertoire old vers le tmp&quot;</span></a>
<a class="sourceLine" id="cb1-94" title="94"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb1-95" title="95"><span class="kw">while [[</span> <span class="ot">!</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb1-96" title="96"> <span class="kw">mv</span> <span class="ot">$destRep</span>.old <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb1-97" title="97"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -P -- <span class="st">&quot;Echec du renommage n°</span><span class="ot">$essai</span><span class="st">&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb1-98" title="98"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb1-99" title="99"><span class="kw">done</span></a>
<a class="sourceLine" id="cb1-100" title="100"></a>
<a class="sourceLine" id="cb1-101" title="101"><span class="kw">print</span> -P -- <span class="st">&quot; publication terminée&quot;</span></a></code></pre></div>
</div>
<div class="en">
<div class="sourceCode" id="cb2"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb2-1" title="1"><span class="co">#!/usr/bin/env zsh</span></a>
<a class="sourceLine" id="cb2-2" title="2"></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="co"># Author: Yann Esposito</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="co"># Mail: yann.esposito@gmail.com</span></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="co"># Synchronize with &quot;mobileMe&quot; iDisk account.</span></a>
<a class="sourceLine" id="cb2-6" title="6"></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="ot">mobileMeUser=</span><span class="st">&quot;firstname.lastname&quot;</span></a>
<a class="sourceLine" id="cb2-8" title="8"><span class="ot">siteName=</span><span class="st">&quot;siteName&quot;</span></a>
<a class="sourceLine" id="cb2-9" title="9"></a>
<a class="sourceLine" id="cb2-10" title="10"><span class="co"># Depending of my hostname the </span></a>
<a class="sourceLine" id="cb2-11" title="11"><span class="kw">if [[</span> <span class="ot">$(</span><span class="kw">hostname</span><span class="ot">)</span> <span class="ot">==</span> <span class="st">'ubuntu'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb2-12" title="12"> <span class="ot">iDisk=</span><span class="st">'/mnt/iDisk'</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="kw">else</span></a>
<a class="sourceLine" id="cb2-14" title="14"> <span class="ot">iDisk=</span><span class="st">&quot;/Volumes/</span><span class="ot">$mobileMeUser</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-16" title="16"></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="ot">root=$HOME</span>/Sites/<span class="ot">$siteName</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="ot">destRep=$iDisk</span>/Web/Sites/<span class="ot">$siteName</span></a>
<a class="sourceLine" id="cb2-19" title="19"></a>
<a class="sourceLine" id="cb2-20" title="20"><span class="kw">[[</span> <span class="ot">!</span> <span class="ot">-d</span> <span class="ot">$root</span><span class="kw"> ]]</span> <span class="kw">&amp;&amp;</span> <span class="kw">{</span> </a>
<a class="sourceLine" id="cb2-21" title="21"> <span class="kw">print</span> -- <span class="st">&quot;</span><span class="ot">$root</span><span class="st"> does not exist ; please verify the configuration (</span><span class="ot">$0</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span>; </a>
<a class="sourceLine" id="cb2-22" title="22"> <span class="kw">exit</span> 1 </a>
<a class="sourceLine" id="cb2-23" title="23"><span class="kw">}</span></a>
<a class="sourceLine" id="cb2-24" title="24"></a>
<a class="sourceLine" id="cb2-25" title="25"><span class="kw">[[</span> <span class="ot">!</span> <span class="ot">-d</span> <span class="ot">$destRep</span><span class="kw"> ]]</span> <span class="kw">&amp;&amp;</span> <span class="kw">{</span> </a>
<a class="sourceLine" id="cb2-26" title="26"> <span class="kw">print</span> -- <span class="st">&quot;</span><span class="ot">$destRep</span><span class="st"> does not exist, please mount the filesystem&quot;</span> <span class="kw">&gt;&amp;2</span>; </a>
<a class="sourceLine" id="cb2-27" title="27"> <span class="kw">exit</span> 1 </a>
<a class="sourceLine" id="cb2-28" title="28"><span class="kw">}</span></a>
<a class="sourceLine" id="cb2-29" title="29"></a>
<a class="sourceLine" id="cb2-30" title="30"><span class="kw">if [[</span> <span class="ot">$1</span> <span class="ot">==</span> <span class="st">'-h'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb2-31" title="31"> <span class="kw">print</span> -- <span class="st">&quot;usage: </span><span class="ot">$0</span><span class="st">:h [-h|-a|-s]&quot;</span></a>
<a class="sourceLine" id="cb2-32" title="32"> <span class="kw">print</span> -- <span class="st">&quot; -a sychronize primary index&quot;</span></a>
<a class="sourceLine" id="cb2-33" title="33"> <span class="kw">print</span> -- <span class="st">&quot; -h show this help&quot;</span></a>
<a class="sourceLine" id="cb2-34" title="34"> <span class="kw">print</span> -- <span class="st">&quot; -s only swap directories&quot;</span></a>
<a class="sourceLine" id="cb2-35" title="35"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-36" title="36"></a>
<a class="sourceLine" id="cb2-37" title="37"><span class="kw">if [[</span> <span class="ot">$1</span> <span class="ot">==</span> <span class="st">'-a'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb2-38" title="38"> <span class="kw">print</span> -- <span class="st">&quot;Index synchronisation (</span><span class="ot">${destRep:h}</span><span class="st">)&quot;</span></a>
<a class="sourceLine" id="cb2-39" title="39"> rsync -av <span class="ot">$root</span>/index.html <span class="ot">${destRep:h}</span>/index.html</a>
<a class="sourceLine" id="cb2-40" title="40"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-41" title="41"></a>
<a class="sourceLine" id="cb2-42" title="42"><span class="kw">print</span> -- <span class="st">&quot;Root = </span><span class="ot">$root</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb2-43" title="43"><span class="kw">print</span> -- <span class="st">&quot;Dest = </span><span class="ot">$destRep</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb2-44" title="44"></a>
<a class="sourceLine" id="cb2-45" title="45"><span class="kw">if [[</span> <span class="ot">!</span> <span class="ot">$1</span> <span class="ot">=</span> <span class="st">'-s'</span><span class="kw"> ]]</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb2-46" title="46"> [[ ! -d <span class="ot">$destRep</span>.tmp ]] <span class="kw">&amp;&amp;</span> <span class="kw">mkdir</span> <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb2-47" title="47"> <span class="kw">print</span> -P -- <span class="st">&quot;%B[Sync =&gt; tmp]%b&quot;</span></a>
<a class="sourceLine" id="cb2-48" title="48"> <span class="ot">result=</span>1</a>
<a class="sourceLine" id="cb2-49" title="49"> <span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb2-50" title="50"> <span class="kw">while</span> <span class="kw">((</span> <span class="ot">$result</span> &gt; 0 <span class="kw">))</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb2-51" title="51"> rsync -arv <span class="ot">$root</span>/Scratch/ <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb2-52" title="52"> <span class="ot">result=$?</span></a>
<a class="sourceLine" id="cb2-53" title="53"> <span class="kw">if</span> <span class="kw">((</span> <span class="ot">$result</span> &gt; 0 <span class="kw">))</span>; <span class="kw">then</span></a>
<a class="sourceLine" id="cb2-54" title="54"> <span class="kw">print</span> -P -- <span class="st">&quot;%Brsync failed%b (try n°</span><span class="ot">$essai</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb2-55" title="55"> <span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-56" title="56"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb2-57" title="57"> <span class="kw">done</span></a>
<a class="sourceLine" id="cb2-58" title="58"><span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-59" title="59"></a>
<a class="sourceLine" id="cb2-60" title="60"><span class="co"># SWAP</span></a>
<a class="sourceLine" id="cb2-61" title="61"><span class="kw">print</span> -P -- <span class="st">&quot;%B[Directory Swap (tmp &lt;=&gt; target)]%b&quot;</span></a>
<a class="sourceLine" id="cb2-62" title="62"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb2-63" title="63"><span class="kw">while [[</span> <span class="ot">-e</span> <span class="ot">$destRep</span>.old<span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb2-64" title="64"> <span class="kw">print</span> -n -- <span class="st">&quot;remove </span><span class="ot">$destRep</span><span class="st">.old&quot;</span></a>
<a class="sourceLine" id="cb2-65" title="65"> <span class="kw">if</span> <span class="kw">((</span>essai&gt;1<span class="kw">))</span>; <span class="kw">then</span> </a>
<a class="sourceLine" id="cb2-66" title="66"> <span class="kw">print</span> <span class="st">&quot; (try n°</span><span class="ot">$essai</span><span class="st">)&quot;</span></a>
<a class="sourceLine" id="cb2-67" title="67"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb2-68" title="68"> <span class="kw">print</span></a>
<a class="sourceLine" id="cb2-69" title="69"> <span class="kw">fi</span></a>
<a class="sourceLine" id="cb2-70" title="70"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb2-71" title="71"> \<span class="kw">rm</span> -rf <span class="ot">$destRep</span>.old</a>
<a class="sourceLine" id="cb2-72" title="72"><span class="kw">done</span></a>
<a class="sourceLine" id="cb2-73" title="73"></a>
<a class="sourceLine" id="cb2-74" title="74"><span class="kw">print</span> -- <span class="st">&quot; renommage du repertoire sandard vers le .old&quot;</span></a>
<a class="sourceLine" id="cb2-75" title="75"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb2-76" title="76"><span class="kw">while [[</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb2-77" title="77"> <span class="kw">mv</span> <span class="ot">$destRep</span> <span class="ot">$destRep</span>.old </a>
<a class="sourceLine" id="cb2-78" title="78"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -- <span class="st">&quot;Failed to rename (try n°</span><span class="ot">$essai</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb2-79" title="79"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb2-80" title="80"><span class="kw">done</span></a>
<a class="sourceLine" id="cb2-81" title="81"></a>
<a class="sourceLine" id="cb2-82" title="82"><span class="kw">print</span> -- <span class="st">&quot; renaming folder tmp (new) to the standard one&quot;</span></a>
<a class="sourceLine" id="cb2-83" title="83"><span class="kw">print</span> -P -- <span class="st">&quot; %BThe WebSite isn't working%b </span><span class="ot">$(</span><span class="kw">date</span><span class="ot">)</span><span class="st">&quot;</span></a>
<a class="sourceLine" id="cb2-84" title="84"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb2-85" title="85"><span class="kw">while [[</span> <span class="ot">!</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb2-86" title="86"> <span class="kw">mv</span> <span class="ot">$destRep</span>.tmp <span class="ot">$destRep</span></a>
<a class="sourceLine" id="cb2-87" title="87"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -P -- <span class="st">&quot;%B[WebSite not working]%b(try n°</span><span class="ot">$essai</span><span class="st">) Failed to rename (mv </span><span class="ot">$destRep</span><span class="st">.tmp </span><span class="ot">$destRep</span><span class="st">)&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb2-88" title="88"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb2-89" title="89"><span class="kw">done</span></a>
<a class="sourceLine" id="cb2-90" title="90"></a>
<a class="sourceLine" id="cb2-91" title="91"><span class="kw">print</span> -P -- <span class="st">&quot;\t===\t%BWEBSITE SHOULD WORK NOW%b\t===&quot;</span></a>
<a class="sourceLine" id="cb2-92" title="92"></a>
<a class="sourceLine" id="cb2-93" title="93"><span class="kw">print</span> -- <span class="st">&quot; rename old folder to tmp folder&quot;</span></a>
<a class="sourceLine" id="cb2-94" title="94"><span class="ot">essai=</span>1</a>
<a class="sourceLine" id="cb2-95" title="95"><span class="kw">while [[</span> <span class="ot">!</span> <span class="ot">-e</span> <span class="ot">$destRep</span><span class="kw"> ]]</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb2-96" title="96"> <span class="kw">mv</span> <span class="ot">$destRep</span>.old <span class="ot">$destRep</span>.tmp</a>
<a class="sourceLine" id="cb2-97" title="97"> <span class="kw">((</span><span class="ot">$?</span><span class="kw">))</span> <span class="kw">&amp;&amp;</span> <span class="kw">print</span> -P -- <span class="st">&quot;Failed to rename n°</span><span class="ot">$essai</span><span class="st">&quot;</span> <span class="kw">&gt;&amp;2</span></a>
<a class="sourceLine" id="cb2-98" title="98"> <span class="kw">((</span>essai++<span class="kw">))</span></a>
<a class="sourceLine" id="cb2-99" title="99"><span class="kw">done</span></a>
<a class="sourceLine" id="cb2-100" title="100"></a>
<a class="sourceLine" id="cb2-101" title="101"><span class="kw">print</span> -P -- <span class="st">&quot; Publish terminated&quot;</span></a></code></pre></div>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/10_Synchronize_Custom_WebSite_with_mobileMe/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/10_Synchronize_Custom_WebSite_with_mobileMe/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-11
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Load Disqus Asynchronously</title>
<meta name="keywords" content="disqus, web, javascript, intense debate, comments" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/11_Load_Disqus_Asynchronously/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Load Disqus Asynchronously</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="update">Update</h1>
<p>In fact this method works for old threads. But it fails to create new post threads. This is why I tried and be conquered by <a href="http://intensedebate.com">intensedebate</a>, as you can see in the bottom of this page.</p>
<p>Remark I didnt have any comment on my blog when I switched. Therefore my lack of influence was a good thing :-).</p>
<hr />
<p>Before begining, I must state that I <strong>love</strong> Disqus.</p>
<p>I know there is a similar blog entry at <a href="http://trephine.org/t/index.php?title=Site_improvements_-_fighting_with_Disqus">Trephine.org</a>. Here I just add a straight and easy way to load disqus asynchronously using jQuery.</p>
<p>I also know there is a jQuery plugin to make just that. Unfortunately I had some issue with CSS.</p>
<p><em>Now lets begin.</em></p>
<hr />
<h1 id="why">Why?</h1>
<p>Why should I want to load the disqus javascript asynchronously?</p>
<ul>
<li>Efficiency: I dont want my page to wait the complete execution of disqus script to load.</li>
<li>More independance: when disqus is down, my page is blocked!</li>
</ul>
<hr />
<h1 id="how">How?</h1>
<p>I give a solution with jQuery, but Im certain it will work with many other js library.</p>
<h3 id="javascript">Javascript</h3>
<p>replace:</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"><span class="op">&lt;</span>script type<span class="op">=</span><span class="st">&quot;text/javascript&quot;</span> src<span class="op">=</span><span class="st">&quot;http://disqus.com/forums/YOUR_DISQUS_ID/embed.js&quot;</span><span class="op">&gt;</span>&lt;/script<span class="op">&gt;</span></a></code></pre></div>
</div>
<p>by</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="va">window</span>.<span class="at">disqus_no_style</span><span class="op">=</span><span class="kw">true</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="at">$</span>(document).<span class="at">ready</span>(<span class="kw">function</span>()<span class="op">{</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="va">$</span>.<span class="at">getScript</span>(<span class="st">&quot;http://disqus.com/forums/YOUR_DISQUS_ID/embed.js&quot;</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="op">}</span>)<span class="op">;</span></a></code></pre></div>
</div>
<p>If you forget the <code>window.disqus_no_style=true;</code> then your page will be blank. Simply because without this option, the javascript use a <code>document.write</code> action after the document was closed, which cause a complete erasing of it.</p>
<h3 id="css">CSS</h3>
<p>But with this option you still need to provide a CSS. This is why you have to copy the css code from the <code>embed.js</code> file and rewrite it in a CSS file. You can <a href="../../../../Scratch/en/blog/11_Load_Disqus_Asynchronously/code/original_disqus.css">download the CSS</a> I obtained.</p>
<hr />
<p>Now its done. I believe all should be fine but I just finished the manip for my own site only 1 hour ago. Therefore there should be some error, tell me if it is the case.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/11_Load_Disqus_Asynchronously/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/11_Load_Disqus_Asynchronously/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-17
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Disqus versus Intense Debate (Why I switched)</title>
<meta name="keywords" content="disqus, intense debate, web, blog" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Disqus versus Intense Debate (Why I switched)</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h1 id="disqus-vs.-intense-debate"><a href="http://disqus.com/">Disqus</a> <em>vs.</em> <a href="http://intensedebate.com/">Intense Debate</a></h1>
<p>I made a blog entry about how I tried to integrate <a href="http://disqus.com">Disqus</a>. I had to wait Disqus comment to be displayed before loading correctly my page. This is why I tried to include it in a “non-blocking” way. Unfortunately, I had <a href="../../../../Scratch/en/blog/11_Load_Disqus_Asynchronously/">difficulties to make it works correctly</a>.</p>
<p>Furthermore, it was not trivial to make comment to be shared between multiple version of the same page (each page has three differents representations, one for each language and one more for the multi-language version).</p>
<p>I am a bit sad to quit <a href="http://disqus.com">Disqus</a> because I must confess <a href="http://giannii.com">giannii</a> had helped me has efficiently as he could. But the problem I had with disqus are inherent to some design choice not simply technical ones.</p>
<p>During the time I tried to integrate <a href="http://disqus.com/">Disqus</a> I never tried <a href="http://intensedebate.com">Intense Debate</a>. Now that I have tried, i must confess it does exactly what I needed.</p>
<p>In order to make it fully asynchronous, youve just to download their common js and replace the following line:</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"><span class="va">document</span>.<span class="at">getElementsByTagName</span>(<span class="st">&quot;head&quot;</span>)[<span class="dv">0</span>].<span class="at">appendChild</span>(commentScript)<span class="op">;</span></a></code></pre></div>
</div>
<p>by:</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="at">$</span>(document).<span class="at">ready</span>( <span class="kw">function</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="va">document</span>.<span class="at">getElementsByTagName</span>(<span class="st">&quot;head&quot;</span>)[<span class="dv">0</span>].<span class="at">appendChild</span>(commentScript)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="op">}</span>)<span class="op">;</span></a></code></pre></div>
</div>
<h2 id="and-the-winner-is-intense-debate">And the Winner is: <a href="http://intensedebate.com/">Intense Debate</a></h2>
<p>To conclude, main advantages (for me) of <a href="http://intensedebate.com/">Intense Debate</a> over <a href="http://disqus.com/">Disqus</a>:</p>
<ul>
<li>Load Asynchronously ; dont block my website</li>
<li>Add for free buttons like “share to any” and load them <strong>asynchronously</strong>.</li>
</ul>
<p>Voilà.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-28
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,272 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - jQuery Tag Cloud</title>
<meta name="keywords" content="jQuery, javascript, web, ruby" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-09-jQuery-Tag-Cloud/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>jQuery Tag Cloud</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Here is how I done the tag cloud of my blog. It is done mostly in jQuery. All my site is static and pages are generated with <a href="http://nanoc.stoneship.org">nanoc</a>. It is (in my humble opinion) the modern geek way to make a website. The tagcloud should work for machine with and without javascript.</p>
<p>This is why Ill give only a Ruby Generator, not a full javascript generator. But you can easily translate from Ruby to Javascript.</p>
<p>Here is what you should obtain:</p>
<hr />
<div>
<p>&lt;%= tagCloud %&gt;</p>
</div>
<hr />
<h1 id="jquery">jQuery</h1>
<p>Here is the simple jQuery code:</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"> <span class="at">$</span>(document).<span class="at">ready</span>( <span class="kw">function</span>()<span class="op">{</span><span class="at">$</span>(<span class="st">'.list'</span>).<span class="at">hide</span>()<span class="op">;}</span> )<span class="op">;</span></a>
<a class="sourceLine" id="cb1-2" title="2"> <span class="kw">function</span> <span class="at">tagSelected</span>(id) <span class="op">{</span></a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="at">$</span>(<span class="st">'.list'</span>).<span class="at">hide</span>()<span class="op">;</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="at">$</span>(<span class="st">'#'</span><span class="op">+</span>id).<span class="at">fadeIn</span>()<span class="op">;</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="at">$</span>(<span class="st">'.tag.selected'</span>).<span class="at">removeClass</span>(<span class="st">'selected'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="at">$</span>(<span class="st">'#tag_'</span><span class="op">+</span>id).<span class="at">addClass</span>(<span class="st">'selected'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb1-7" title="7"> <span class="op">}</span></a></code></pre></div>
</div>
<p>This code will hide all the div containing links to articles containing the tag. And create a function do show the div containing the tag.</p>
<p>For each tag I create a span element:</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb2-1" title="1"> <span class="kw">&lt;span</span><span class="ot"> style=</span><span class="st">&quot;font-size: 1.0em;&quot;</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="ot"> class=</span><span class="st">&quot;tag&quot;</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="ot"> onClick=</span><span class="st">&quot;tagSelected('[TAG]')&quot;</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="ot"> id=</span><span class="st">&quot;tag_[TAG]&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> [TAG]</a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">&lt;/span&gt;</span></a></code></pre></div>
</div>
<p>and a div containing links associtated to this tag:</p>
<div>
<div class="sourceCode" id="cb3"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb3-1" title="1"> <span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;[TAG]&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb3-2" title="2"> <span class="kw">&lt;h4&gt;</span>[TAG]<span class="kw">&lt;/h4&gt;</span></a>
<a class="sourceLine" id="cb3-3" title="3"> <span class="kw">&lt;ul&gt;</span></a>
<a class="sourceLine" id="cb3-4" title="4"> <span class="kw">&lt;li&gt;</span> LINK 1 <span class="kw">&lt;/li&gt;</span></a>
<a class="sourceLine" id="cb3-5" title="5"> <span class="kw">&lt;li&gt;</span> LINK 2 <span class="kw">&lt;/li&gt;</span></a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="kw">&lt;/ul&gt;</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="kw">&lt;/div&gt;</span></a></code></pre></div>
</div>
<hr />
<h1 id="nanoc">nanoc</h1>
<p>Here is how I generate this using nanoc 2.</p>
<p>If you want to make it fully jQuery one, it shouldnt be too difficult, to use my ruby code and translate it into javascript.</p>
<p>In a first time <code>tags</code> correpond of the list of all tags.</p>
<div>
<div class="sourceCode" id="cb4"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb4-1" title="1"><span class="kw">def</span> tags</a>
<a class="sourceLine" id="cb4-2" title="2"> <span class="kw">return</span> <span class="ot">@items</span>.tags.join(<span class="st">', '</span>)</a>
<a class="sourceLine" id="cb4-3" title="3"><span class="kw">end</span></a></code></pre></div>
</div>
<p>A function to create a data structure associating to each tag its occurence.</p>
<div>
<div class="sourceCode" id="cb5"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb5-1" title="1"><span class="co"># generate an hash tag =&gt; number of occurence of tag</span></a>
<a class="sourceLine" id="cb5-2" title="2"><span class="kw">def</span> tagNumber</a>
<a class="sourceLine" id="cb5-3" title="3"> tags={}</a>
<a class="sourceLine" id="cb5-4" title="4"> <span class="ot">@items</span>.each <span class="kw">do</span> |p|</a>
<a class="sourceLine" id="cb5-5" title="5"> <span class="kw">if</span> p.tags.nil?</a>
<a class="sourceLine" id="cb5-6" title="6"> <span class="kw">next</span></a>
<a class="sourceLine" id="cb5-7" title="7"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb5-8" title="8"> p.tags.each <span class="kw">do</span> |t|</a>
<a class="sourceLine" id="cb5-9" title="9"> <span class="kw">if</span> tags[t]</a>
<a class="sourceLine" id="cb5-10" title="10"> tags[t]+=<span class="dv">1</span></a>
<a class="sourceLine" id="cb5-11" title="11"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb5-12" title="12"> tags[t]=<span class="dv">1</span></a>
<a class="sourceLine" id="cb5-13" title="13"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb5-14" title="14"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb5-15" title="15"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb5-16" title="16"> <span class="kw">return</span> tags</a>
<a class="sourceLine" id="cb5-17" title="17"><span class="kw">end</span></a></code></pre></div>
</div>
<p>I also need a data structure who associate to each tag a list of pages (at least url and title).</p>
<div>
<div class="sourceCode" id="cb6"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb6-1" title="1"><span class="co"># generate an hash tag =&gt; [ page1, page2 ... ]</span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="kw">def</span> tagRefs</a>
<a class="sourceLine" id="cb6-3" title="3"> tagLinks={}</a>
<a class="sourceLine" id="cb6-4" title="4"> <span class="ot">@items</span>.each <span class="kw">do</span> |p|</a>
<a class="sourceLine" id="cb6-5" title="5"> <span class="kw">if</span> p.tags.nil?</a>
<a class="sourceLine" id="cb6-6" title="6"> <span class="kw">next</span></a>
<a class="sourceLine" id="cb6-7" title="7"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb6-8" title="8"> p.tags.each <span class="kw">do</span> |t|</a>
<a class="sourceLine" id="cb6-9" title="9"> <span class="kw">if</span> tagLinks[t].nil?</a>
<a class="sourceLine" id="cb6-10" title="10"> tagLinks[t]=[ p ]</a>
<a class="sourceLine" id="cb6-11" title="11"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb6-12" title="12"> tagLinks[t] &lt;&lt;= p</a>
<a class="sourceLine" id="cb6-13" title="13"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb6-14" title="14"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb6-15" title="15"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb6-16" title="16"> <span class="kw">return</span> tagLinks</a>
<a class="sourceLine" id="cb6-17" title="17"><span class="kw">end</span></a></code></pre></div>
</div>
<p>Calculate the real size of each tag to be displayed.</p>
<p>I choosen not to use the full range of size for all the tag. Because if no tag has more than <code>n</code> (here 10) occurences, then it doesnt deserve to be of the maximal size.</p>
<div>
<div class="sourceCode" id="cb7"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb7-1" title="1"><span class="kw">def</span> tagRealSize</a>
<a class="sourceLine" id="cb7-2" title="2"> tags=tagNumber</a>
<a class="sourceLine" id="cb7-3" title="3"> max=tags.values.max</a>
<a class="sourceLine" id="cb7-4" title="4"> min=tags.values.min</a>
<a class="sourceLine" id="cb7-5" title="5"> <span class="co"># size in CSS em.</span></a>
<a class="sourceLine" id="cb7-6" title="6"> minSize=<span class="fl">1.0</span></a>
<a class="sourceLine" id="cb7-7" title="7"> maxSize=<span class="fl">2.5</span></a>
<a class="sourceLine" id="cb7-8" title="8"> tagSize={}</a>
<a class="sourceLine" id="cb7-9" title="9"> tags.each <span class="kw">do</span> |t,n|</a>
<a class="sourceLine" id="cb7-10" title="10"> <span class="kw">if</span> ( max == min )</a>
<a class="sourceLine" id="cb7-11" title="11"> tagSize[t]=minSize</a>
<a class="sourceLine" id="cb7-12" title="12"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb7-13" title="13"> <span class="co"># normalized value between 0 and 1</span></a>
<a class="sourceLine" id="cb7-14" title="14"> <span class="co"># if not tag appear more than 10 times,</span></a>
<a class="sourceLine" id="cb7-15" title="15"> <span class="co"># then it cannot have the maximal size</span></a>
<a class="sourceLine" id="cb7-16" title="16"> tagSize[t]=[ ( n - min + <span class="fl">0.0</span> ) / ( max - min ) ,</a>
<a class="sourceLine" id="cb7-17" title="17"> (n - min) / <span class="fl">10.0</span> ].min</a>
<a class="sourceLine" id="cb7-18" title="18"> <span class="co"># from normalized size to real size</span></a>
<a class="sourceLine" id="cb7-19" title="19"> tagSize[t]=( tagSize[t] ) * (maxSize - minSize) + minSize</a>
<a class="sourceLine" id="cb7-20" title="20"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb7-21" title="21"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb7-22" title="22"> <span class="kw">return</span> tagSize</a>
<a class="sourceLine" id="cb7-23" title="23"><span class="kw">end</span></a></code></pre></div>
</div>
<p>Finaly a function to generate the XHTML/jQuery code</p>
<div>
<div class="sourceCode" id="cb8"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb8-1" title="1"><span class="co"># generate an XHTML/jQuery code for tag cloud</span></a>
<a class="sourceLine" id="cb8-2" title="2"><span class="kw">def</span> tagCloud</a>
<a class="sourceLine" id="cb8-3" title="3"> tagLinks=tagRefs</a>
<a class="sourceLine" id="cb8-4" title="4"> tagSize=tagRealSize</a>
<a class="sourceLine" id="cb8-5" title="5"></a>
<a class="sourceLine" id="cb8-6" title="6"> <span class="co"># begin to write the code</span></a>
<a class="sourceLine" id="cb8-7" title="7"> tagCloud=<span class="ot">%{</span><span class="st">&lt;script type=&quot;text/javascript&quot;&gt;</span></a>
<a class="sourceLine" id="cb8-8" title="8"><span class="st"> $(document).ready( function(){$('.list').hide();} );</span></a>
<a class="sourceLine" id="cb8-9" title="9"><span class="st"> function tagSelected(id) {</span></a>
<a class="sourceLine" id="cb8-10" title="10"><span class="st"> $('.list').hide();</span></a>
<a class="sourceLine" id="cb8-11" title="11"><span class="st"> $('#'+id).fadeIn();</span></a>
<a class="sourceLine" id="cb8-12" title="12"><span class="st"> $('.tag.selected').removeClass('selected');</span></a>
<a class="sourceLine" id="cb8-13" title="13"><span class="st"> $('#tag_'+id).addClass('selected');</span></a>
<a class="sourceLine" id="cb8-14" title="14"><span class="st"> }</span></a>
<a class="sourceLine" id="cb8-15" title="15"><span class="st"> &lt;/script&gt;&lt;div id=&quot;tagcloud&quot;&gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-16" title="16"> <span class="co"># Creation of the tags &lt;span&gt;</span></a>
<a class="sourceLine" id="cb8-17" title="17"> tagSize.sort{|a,b| a[<span class="dv">0</span>].downcase &lt;=&gt; b[<span class="dv">0</span>].downcase}.each <span class="kw">do</span> |t,s|</a>
<a class="sourceLine" id="cb8-18" title="18"> tag_in_id=t.gsub(<span class="ot">/\W/</span>,<span class="ch">'_'</span>)</a>
<a class="sourceLine" id="cb8-19" title="19"> <span class="co"># HTML protected version of the tag</span></a>
<a class="sourceLine" id="cb8-20" title="20"> <span class="co"># for example, replace ' ' by '&amp;nbsp;'</span></a>
<a class="sourceLine" id="cb8-21" title="21"> <span class="kw">protected</span>=t.gsub(<span class="ot">/&amp;/</span>,<span class="st">'&amp;amp;'</span>).gsub(<span class="ot">/ /</span>,<span class="st">'&amp;nbsp;'</span>).gsub(<span class="ot">/&lt;/</span>,<span class="st">'&amp;lt;'</span>).gsub(<span class="ot">/&gt;/</span>,<span class="st">'&amp;gt;'</span>)</a>
<a class="sourceLine" id="cb8-22" title="22"> tagCloud &lt;&lt;=<span class="ot"> %{</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="st"> &lt;span style=&quot;font-size: </span><span class="ot">#{</span>s<span class="ot">}</span><span class="st">em;&quot;</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="st"> class=&quot;tag&quot;</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="st"> onClick=&quot;tagSelected('</span><span class="ot">#{</span>tag_in_id<span class="ot">}</span><span class="st">')&quot;</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="st"> id=&quot;tag_</span><span class="ot">#{</span>tag_in_id<span class="ot">}</span><span class="st">&quot;&gt;</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="st"> </span><span class="ot">#{</span><span class="kw">protected</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-28" title="28"><span class="st"> &lt;/span&gt; </span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-29" title="29"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb8-30" title="30"> tagCloud &lt;&lt;=<span class="ot"> %{</span><span class="st">&lt;/div&gt;&lt;div id=&quot;hiddenDivs&quot; &gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-31" title="31"> <span class="co"># Creation of the divs containing links associated to a tag.</span></a>
<a class="sourceLine" id="cb8-32" title="32"> tagLinks.each <span class="kw">do</span> |t,l|</a>
<a class="sourceLine" id="cb8-33" title="33"> tag_in_id=t.gsub(<span class="ot">/\W/</span>,<span class="ch">'_'</span>)</a>
<a class="sourceLine" id="cb8-34" title="34"> tagCloud &lt;&lt;=<span class="ot"> %{</span></a>
<a class="sourceLine" id="cb8-35" title="35"><span class="st"> &lt;div id=&quot;</span><span class="ot">#{</span>tag_in_id<span class="ot">}</span><span class="st">&quot; class=&quot;list&quot;&gt;</span></a>
<a class="sourceLine" id="cb8-36" title="36"><span class="st"> &lt;h4&gt;</span><span class="ot">#{</span>t<span class="ot">}</span><span class="st">&lt;/h4&gt;&lt;ul&gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-37" title="37"> <span class="co"># generate the link list</span></a>
<a class="sourceLine" id="cb8-38" title="38"> l.each <span class="kw">do</span> |p|</a>
<a class="sourceLine" id="cb8-39" title="39"> tagCloud &lt;&lt;=<span class="ot"> %{</span><span class="st">&lt;li&gt;&lt;a href=&quot;</span><span class="ot">#{</span>p.path<span class="ot">}</span><span class="st">&quot;&gt;</span><span class="ot">#{</span>p.title<span class="ot">}</span><span class="st">&lt;/a&gt;&lt;/li&gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-40" title="40"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb8-41" title="41"> tagCloud &lt;&lt;=<span class="ot"> %{</span><span class="st">&lt;/ul&gt;&lt;/div&gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-42" title="42"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb8-43" title="43"> tagCloud &lt;&lt;=<span class="ot"> %{</span><span class="st">&lt;/div&gt;</span><span class="ot">}</span></a>
<a class="sourceLine" id="cb8-44" title="44"> <span class="kw">return</span> tagCloud <span class="co"># yeah I know it is not necessary</span></a>
<a class="sourceLine" id="cb8-45" title="45"><span class="kw">end</span></a></code></pre></div>
</div>
<p>You can <a href="../../../../Scratch/en/blog/2009-09-jQuery-Tag-Cloud/code/tag.rb">download the complete file</a> to put in your lib directory.</p>
<p>Of course to be nice you need the associated CSS</p>
<div>
<div class="sourceCode" id="cb9"><pre class="sourceCode css"><code class="sourceCode css"><a class="sourceLine" id="cb9-1" title="1"></a>
<a class="sourceLine" id="cb9-2" title="2"><span class="er">// Change the color when mouse over</span></a>
<a class="sourceLine" id="cb9-3" title="3"><span class="fu">.tag</span><span class="in">:hover</span> {</a>
<a class="sourceLine" id="cb9-4" title="4"> <span class="kw">color</span>: <span class="cn">#cc0000</span><span class="op">;</span> }</a>
<a class="sourceLine" id="cb9-5" title="5"></a>
<a class="sourceLine" id="cb9-6" title="6"><span class="er">// Change the color when tag selected</span></a>
<a class="sourceLine" id="cb9-7" title="7"><span class="fu">.tag.selected</span> {</a>
<a class="sourceLine" id="cb9-8" title="8"> <span class="kw">color</span>: <span class="cn">#6c0000</span><span class="op">;</span> }</a>
<a class="sourceLine" id="cb9-9" title="9"></a>
<a class="sourceLine" id="cb9-10" title="10"><span class="er">// a bit of space and pointer cursor</span></a>
<a class="sourceLine" id="cb9-11" title="11"><span class="fu">.tag</span> {</a>
<a class="sourceLine" id="cb9-12" title="12"> <span class="kw">cursor</span>: <span class="dv">pointer</span><span class="op">;</span></a>
<a class="sourceLine" id="cb9-13" title="13"> <span class="kw">margin-left</span>: <span class="dv">.5</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb9-14" title="14"> <span class="kw">margin-right</span>: <span class="dv">.5</span><span class="dt">em</span><span class="op">;</span> }</a></code></pre></div>
</div>
<p>Thats all folks.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-jQuery-Tag-Cloud/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-jQuery-Tag-Cloud/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-23
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,153 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - replace all except some part</title>
<meta name="keywords" content="ruby, regexp, regular expression" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-09-replace-all-except-some-part/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>replace all except some part</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>My problem is simple:</p>
<p>I want to filter a text except some part of it. I can match easily the part I dont want to be filtered. For example</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1">...</a>
<a class="sourceLine" id="cb1-2" title="2">text</a>
<a class="sourceLine" id="cb1-3" title="3">...</a>
<a class="sourceLine" id="cb1-4" title="4">BEGIN not to filter</a>
<a class="sourceLine" id="cb1-5" title="5">...</a>
<a class="sourceLine" id="cb1-6" title="6">text</a>
<a class="sourceLine" id="cb1-7" title="7">...</a>
<a class="sourceLine" id="cb1-8" title="8">END not to filter</a>
<a class="sourceLine" id="cb1-9" title="9">...</a>
<a class="sourceLine" id="cb1-10" title="10">text</a>
<a class="sourceLine" id="cb1-11" title="11">...</a></code></pre></div>
</div>
<p>I searched a better way to do that, but the best I can do is using <code>split</code> and <code>scan</code>.</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">def</span> allExceptCode( f, content )</a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="co"># Beware the behaviour will change if you add</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="co"># parenthesis (groups) to the regexp!</span></a>
<a class="sourceLine" id="cb2-4" title="4"> regexp=<span class="ot">/&lt;code[^&gt;]*&gt;.*?&lt;\/code&gt;|&lt;pre[^&gt;]*&gt;.*?&lt;\/pre&gt;/m</span></a>
<a class="sourceLine" id="cb2-5" title="5"> tmp=<span class="st">&quot;&quot;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> mem=[]</a>
<a class="sourceLine" id="cb2-7" title="7"> content.scan(regexp).each <span class="kw">do</span> |c|</a>
<a class="sourceLine" id="cb2-8" title="8"> mem &lt;&lt;= c</a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb2-10" title="10"> i=<span class="dv">0</span></a>
<a class="sourceLine" id="cb2-11" title="11"> content.split(regexp).each <span class="kw">do</span> |x|</a>
<a class="sourceLine" id="cb2-12" title="12"> tmp &lt;&lt;= send(f,x) </a>
<a class="sourceLine" id="cb2-13" title="13"> <span class="kw">if</span> <span class="kw">not</span> mem[i].nil? </a>
<a class="sourceLine" id="cb2-14" title="14"> tmp &lt;&lt;= mem[i]</a>
<a class="sourceLine" id="cb2-15" title="15"> i+=<span class="dv">1</span></a>
<a class="sourceLine" id="cb2-16" title="16"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb2-17" title="17"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb2-18" title="18"> tmp</a>
<a class="sourceLine" id="cb2-19" title="19"><span class="kw">end</span></a></code></pre></div>
</div>
<p>An usage is:</p>
<div>
<div class="sourceCode" id="cb3"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb3-1" title="1"><span class="kw">def</span> filter(content)</a>
<a class="sourceLine" id="cb3-2" title="2"> content.gsub(<span class="ot">/e/</span>,<span class="ch">'X'</span>)</a>
<a class="sourceLine" id="cb3-3" title="3"><span class="kw">end</span></a>
<a class="sourceLine" id="cb3-4" title="4">...</a>
<a class="sourceLine" id="cb3-5" title="5">allExceptCode(<span class="st">:filter</span>, content)</a>
<a class="sourceLine" id="cb3-6" title="6">...</a></code></pre></div>
</div>
<p>A better syntax would be:</p>
<div>
<div class="sourceCode" id="cb4"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb4-1" title="1"><span class="co"># !!!!!!!!!! THIS SYNTAX DOES NOT WORK !!!!!!! #</span></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="kw">def</span> allExceptCode( f, content )</a>
<a class="sourceLine" id="cb4-3" title="3"> regexp=<span class="ot">/&lt;code[^&gt;]*&gt;.*?&lt;\/code&gt;/m</span></a>
<a class="sourceLine" id="cb4-4" title="4"> tmp=<span class="st">&quot;&quot;</span></a>
<a class="sourceLine" id="cb4-5" title="5"> content.split(regexp).each <span class="kw">do</span> |x|</a>
<a class="sourceLine" id="cb4-6" title="6"> separator=<span class="dt">$&amp;</span></a>
<a class="sourceLine" id="cb4-7" title="7"> tmp &lt;&lt;= send(f,x) </a>
<a class="sourceLine" id="cb4-8" title="8"> <span class="kw">if</span> <span class="kw">not</span> separator.nil?</a>
<a class="sourceLine" id="cb4-9" title="9"> tmp &lt;&lt;= separator</a>
<a class="sourceLine" id="cb4-10" title="10"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb4-11" title="11"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb4-12" title="12"> tmp</a>
<a class="sourceLine" id="cb4-13" title="13"><span class="kw">end</span></a></code></pre></div>
</div>
<p>I would expect the split make a search on a regular expression and then give the matched expression into the <code>$&amp;</code> variable. But it is not the case.</p>
<p>If someone know a nicer way to do that I will be happy to know how.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-replace-all-except-some-part/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-09-replace-all-except-some-part/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-09-22
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,118 @@
#!/usr/bin/env zsh
# Script synchronisant le site sur me.com
# normalement, le site est indisponible le moins de temps possible
# le temps de deux renommages de répertoire
# get configuration
# mostly directories
source $0:h/config
# get trycp function (copy until success)
source $0:h/webdav-framework
if [[ $1 == '-h' ]]; then
print -- "usage : $0:h [-h|-s|-d]"
print -- " -a sychronise aussi l'index"
print -- " -h affiche l'aide"
print -- " -d modification directe (pas de swap)"
print -- " -s swappe simplement les répertoires"
fi
# publication incrementale
function incrementalPublish {
local ydestRep=$destRep$suffix
localRef="$srcRep/map.yrf"
print -- "Creation du fichier de references"
create-reference-file.sh > $localRef
remoteRef="/tmp/remoteSiteMapRef.$$.yrf"
if [[ ! -e "$ydestRep/map.yrf" ]]; then
# pas de fichier de reference sur la cible
print -- "pas de fichier de reference sur la cible, passage en mode rsync"
rsyncPublish
swap
else
trycp "$ydestRep/map.yrf" "$remoteRef"
typeset -U filesToUpdate
filesToUpdate=( $(diff $localRef $remoteRef | awk '/^[<>]/ {print $2}' ) )
if ((${#filesToUpdate} == 1)); then
print -- "Seul le fichier ${filesToUpdate} sera téléversé"
elif ((${#filesToUpdate}<10)); then
print -- "${#filesToUpdate} fichiers seront téléversés :"
print -- "${filesToUpdate}"
else
print -- "${#filesToUpdate} fichiers seront téléversés"
fi
# copy all file with some differences
# except the map in case of error
for element in $filesToUpdate; do
if [[ $element == "/map.yrf" ]]; then
continue
fi
if [[ -e $srcRep$element ]]; then
trycp $srcRep$element $ydestRep$element
else
tryrm $ydestRep$element
fi
done
# if all went fine, copy the map file
trycp $srcRep/map.yrf $ydestRep/map.yrf
# remove the temporary file
\rm $remoteRef
# if we have used the tmp directory we swap
if [[ "$suffix" != "" ]]; then
swap
fi
fi
}
# publication via rsync
function rsyncPublish {
result=1
essai=1
while (( $result > 0 )); do
print -- rsync -arv $srcRep/ $destRep.tmp
if ((!testmode)); then
rsync -arv $srcRep/ $destRep.tmp
fi
result=$?
if (( $result > 0 )); then
print -P -- "%BEchec du rsync%b (essai n°$essai)" >&2
fi
((essai++))
done
}
# swap
function swap {
print -P -- "%B[Directory Swap (tmp <=> target)]%b"
[[ -e $destRep.old ]] && tryrm $destRep.old
print -- " renommage du repertoire sandard vers le .old"
tryrename $destRep $destRep.old
print -- " renommage du repertoire tmp (nouveau) vers le standard"
print -P -- "%B[Site Indisponible]%b $(date)"
tryrename $destRep.tmp $destRep
print -P -- "%B[Site Disponible]%b $(date)"
print -- " renommage du repertoire old vers le tmp"
tryrename $destRep.old $destRep.tmp
print -P -- " publication terminée"
}
print -- "Root = $webroot"
print -- "Dest = $destRep"
if [[ "$1" = "-s" ]]; then
swap
else
if [[ "$1" = "-d" ]]; then
suffix=""
else
suffix=".tmp"
fi
print -P -- "%BSync%b[${Root:t} => ${destRep:t}$suffix]"
incrementalPublish
fi

View file

@ -0,0 +1,108 @@
#!/usr/bin/env zsh
function samelineprint {
print -n -P -- "\r$*"
}
# avec 1 essai par seconde: 300 = 5 minutes
maxessais=300
# try to create a directory until success
function trymkdir {
target="$1"
print -- mkdir -p $target
local essai=1
while ! mkdir -p $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to copy until success
function trycp {
element="$1"
target="$2"
if [[ ! -d ${target:h} ]]; then
trymkdir ${target:h}
fi
local essai=1
print -- cp $element $target
while ! \cp $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to remove until success
function tryrm {
target="$1"
local essai=1
local options=''
[[ -d $target ]] && options='-rf'
print -- rm $options $target
while ! rm $options $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
essai=1
while [[ -e $element ]]; do
samelineprint "rm reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to rename until success
function tryrename {
element="$1"
target="$2"
local essai=1
while [[ -e $target ]]; do
samelineprint "Echec n°$essai le fichier $target existe déjà"
((essai++))
((essai>maxessais)) && exit 5
sleep 1
done
print -- mv $element $target
while ! mv $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 4
done
essai=1
while [[ -e $element ]]; do
samelineprint "mv reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to move until success
function trymv {
element="$1"
target="$2"
local essai=1
print -- mv $element $target
while ! mv $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
essai=1
while [[ -e $element ]]; do
samelineprint "mv reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - custom website synchronisation with mobileme (2)</title>
<meta name="keywords" content="Apple, mobileme, WebDav, synchronisation, zsh, script" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>custom website synchronisation with mobileme (2)</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I already talked about how <a href="../../../../Scratch/en/blog/10_Synchronize_Custom_WebSite_with_mobileMe">I synchronized my website with mobileme</a>. I ameliorated this script in order to make it incremental.</p>
<p>Here is my new script, it first create a map which associate to each file its hash. After that it compare this file to the remote one. Then for each different file, update the content.</p>
<p>Even with this script I also have some problem. Mostly due to webdav issues. For example, renaming a folder work really badly (on Linux at least). I use webdavfs. For example:</p>
<div>
<code class="zsh"> mv folder folder2 </code>
</div>
<p>It returns OK and Ive got:</p>
<div>
<code class="zsh"> $ ls folder folder2 </code>
</div>
<p>Booh….</p>
<p>In order to handle most webdav issues I use a <em>framework</em> in zsh. It handle almost all except the correct renaming of folder. Working on it… Anyway here is the code I use.</p>
<div>
<p><code class="zsh" file="webdav-framework"> #!/usr/bin/env zsh</p>
<p>function samelineprint { print -n -P "\r$*" }</p>
<h1 id="avec-1-essai-par-seconde-300-5-minutes">avec 1 essai par seconde: 300 = 5 minutes</h1>
<p>maxessais=300</p>
<h1 id="try-to-create-a-directory-until-success">try to create a directory until success</h1>
<p>function trymkdir { target=“$1” print mkdir -p $target local essai=1 while ! mkdir -p <span class="math inline">$target; do samelineprint "Echec: essai n°$</span>essai" ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done print }</p>
<h1 id="try-to-copy-until-success">try to copy until success</h1>
<p>function trycp { element=“$1” target=“$2” if [[ ! -d ${target:h} ]]; then trymkdir ${target:h} fi local essai=1 print cp $element $target while ! $element <span class="math inline">$target; do samelineprint "Echec: essai n°$</span>essai" ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done print }</p>
<h1 id="try-to-remove-until-success">try to remove until success</h1>
<p>function tryrm { target=“$1” local essai=1 local options= [[ -d $target ]] &amp;&amp; options=-rf print rm $options $target while ! rm $options <span class="math inline">$target; do samelineprint "Echec: essai n°$</span>essai" ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done essai=1 while [[ -e $element ]]; do samelineprint “rm reussi mais fichier source non disparu n°$essai” sleep 1 ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done print }</p>
<h1 id="try-to-rename-until-success">try to rename until success</h1>
<p>function tryrename { element=“$1” target=“$2” local essai=1 while [[ -e $target ]]; do samelineprint “Echec n°$essai le fichier $target existe déjà” ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 sleep 1 done print mv $element $target while ! mv $element <span class="math inline">$target; do samelineprint "Echec: essai n°$</span>essai" ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 4 done essai=1 while [[ -e $element ]]; do samelineprint “mv reussi mais fichier source non disparu n°$essai” sleep 1 ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done print }</p>
<h1 id="try-to-move-until-success">try to move until success</h1>
function trymv { element=“$1” target=“$2” local essai=1 print mv $element $target while ! mv $element <span class="math inline">$target; do samelineprint "Echec: essai n°$</span>essai" ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done essai=1 while [[ -e $element ]]; do samelineprint “mv reussi mais fichier source non disparu n°$essai” sleep 1 ((essai++)) ((essai&gt;maxessais)) &amp;&amp; exit 5 done print } </code>
</div>
<p>And here is the code on how I synchronize my website. There is a little cryptic code. It correspond a problem caused by the bluecloth filter which is a markdown program made in ruby. Each time my email is written it is transformed differently. This is why I remove this part from the content of each html file. Without it, all my files containing email are different at each regeneration of my website.</p>
<div>
<p><code class="zsh" file="publish"> #!/usr/bin/env zsh</p>
<h1 id="script-synchronisant-le-site-sur-me.com">Script synchronisant le site sur me.com</h1>
<h1 id="normalement-le-site-est-indisponible-le-moins-de-temps-possible">normalement, le site est indisponible le moins de temps possible</h1>
<h1 id="le-temps-de-deux-renommages-de-répertoire">le temps de deux renommages de répertoire</h1>
<h1 id="get-configuration">get configuration</h1>
<h1 id="mostly-directories">mostly directories</h1>
<p>source $0:h/config</p>
<h1 id="get-trycp-function-copy-until-success">get trycp function (copy until success)</h1>
<p>source $0:h/webdav-framework</p>
<p>if [[ $1 == -h ]]; then print “usage : $0:h [-h|-s|-d]” print " -a sychronise aussi lindex" print " -h affiche laide" print " -d modification directe (pas de swap)" print " -s swappe simplement les répertoires" fi</p>
<h1 id="publication-incrementale">publication incrementale</h1>
<p>function incrementalPublish { local ydestRep=<span class="math inline"><em>d</em><em>e</em><em>s</em><em>t</em><em>R</em><em>e</em><em>p</em></span>suffix localRef=“$srcRep/map.yrf” print “Creation du fichier de references” create-reference-file.sh &gt; <span class="math inline">$localRef remoteRef="/tmp/remoteSiteMapRef.$</span><span class="math inline">$.yrf" if [[ ! -e "$</span>ydestRep/map.yrf" ]]; then # pas de fichier de reference sur la cible print “pas de fichier de reference sur la cible, passage en mode rsync” rsyncPublish swap else trycp “<span class="math inline">$ydestRep/map.yrf" "$</span>remoteRef” typeset -U filesToUpdate filesToUpdate=( $(diff $localRef $remoteRef | awk /<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>/ {print <span class="math inline">$2}' ) ) if (($</span>{#filesToUpdate} == 1)); then print “Seul le fichier <span class="math inline">${filesToUpdate} sera téléversé" elif (($</span>{#filesToUpdate}&lt;10)); then print –”<span class="math inline">${#filesToUpdate} fichiers seront téléversés :" print -- "$</span>{filesToUpdate}" else print “${#filesToUpdate} fichiers seront téléversés” fi # copy all file with some differences # except the map in case of error for element in $filesToUpdate; do if [[ $element == “/map.yrf” ]]; then continue fi if [[ -e <span class="math inline"><em>s</em><em>r</em><em>c</em><em>R</em><em>e</em><em>p</em></span>element ]]; then trycp <span class="math inline"><em>s</em><em>r</em><em>c</em><em>R</em><em>e</em><em>p</em></span>element <span class="math inline"><em>y</em><em>d</em><em>e</em><em>s</em><em>t</em><em>R</em><em>e</em><em>p</em></span>element else tryrm <span class="math inline"><em>y</em><em>d</em><em>e</em><em>s</em><em>t</em><em>R</em><em>e</em><em>p</em></span>element fi done # if all went fine, copy the map file trycp $srcRep/map.yrf $ydestRep/map.yrf # remove the temporary file }</p>
<h1 id="publication-via-rsync">publication via rsync</h1>
<p>function rsyncPublish { result=1 essai=1 while (( $result &gt; 0 )); do print rsync -arv $srcRep/ $destRep.tmp if ((!testmode)); then rsync -arv $srcRep/ <span class="math inline"><em>d</em><em>e</em><em>s</em><em>t</em><em>R</em><em>e</em><em>p</em>.<em>t</em><em>m</em><em>p</em><em>f</em><em>i</em><em>r</em><em>e</em><em>s</em><em>u</em><em>l</em><em>t</em>=</span>? if (( <span class="math inline">$result &gt; 0 )); then print -P -- "%BEchec du rsync%b (essai n°$</span>essai)" &gt;&amp;2 fi ((essai++)) done }</p>
<h1 id="swap">swap</h1>
<p>function swap { print -P “%B[Directory Swap (tmp &lt;=&gt; target)]%b” [[ -e $destRep.old ]] &amp;&amp; tryrm $destRep.old</p>
<pre><code>print -- &quot; renommage du repertoire sandard vers le .old&quot;
tryrename $destRep $destRep.old
print -- &quot; renommage du repertoire tmp (nouveau) vers le standard&quot;
print -P -- &quot;%B[Site Indisponible]%b $(date)&quot;
tryrename $destRep.tmp $destRep
print -P -- &quot;%B[Site Disponible]%b $(date)&quot;
print -- &quot; renommage du repertoire old vers le tmp&quot;
tryrename $destRep.old $destRep.tmp
print -P -- &quot; publication terminée&quot;</code></pre>
<p>}</p>
<p>print “Root = $webroot” print “Dest = $destRep”</p>
if [[ “$1” = “-s” ]]; then swap else if [[ “$1” = “-d” ]]; then suffix="" else suffix=“.tmp” fi print -P “%BSync%b[${Root:t} =&gt; <span class="math inline"><em>d</em><em>e</em><em>s</em><em>t</em><em>R</em><em>e</em><em>p</em>:<em>t</em></span>suffix]” incrementalPublish fi </code>
</div>
<p>This is my way to replace <code>rsync</code> with filesystem not handling it. Hope it is usefull. Ill be happy to hear a way to handle the webdav rename folder problem. This is really annoying.</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>&lt;&gt;<a href="#fnref1" class="footnote-back"></a></p></li>
</ol>
</section>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-28
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,17 @@
// Remove all CSS I don't want to use on IE
$('link[rel=stylesheet]').each(function(i)
{
if (this.getAttribute('href') == '/css/layout.css')
this.disabled = true;
if (this.getAttribute('href') == '/css/shadows.css')
this.disabled = true;
if (this.getAttribute('href') == '/css/gen.css')
this.disabled = true;
}) ;
// Append the CSS for IE only
$('head').append('<link rel="stylesheet" type="text/css" href="/css/ie.css"/>');
// I also add a message on top of the page
$('body').prepend('<div id="iemessage"><p><span class="fr"><em>Avec <a href="http://www.firefox.com"> Firefox </a> et <a href="http://www.apple.com/safari">Safari</a> cette page est bien plus jolie !</em></span><span class="en"><em>This page is far nicer with <a href="http://www.firefox.com"> Firefox </a> and <a href="http://www.apple.com/safari">Safari</a>!</em></span></p>.</div>');

View file

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - How to handle evil IE</title>
<meta name="keywords" content="web, webdesign, jQuery" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-30-How-to-handle-evil-IE/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>How to handle evil IE</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>For developer IE is a nightmare. This is why, I use a method to disable my standard CSS and enable a IE only CSS. I use jQuery to accomplish that.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"><span class="at">$</span>(document).<span class="at">ready</span>( <span class="kw">function</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb1-2" title="2"> <span class="cf">if</span> (<span class="va">$</span>.<span class="at">browser</span>[<span class="st">&quot;msie&quot;</span>]) <span class="op">{</span></a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="co">// include the ie.js file</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="at">$</span>(<span class="st">'head'</span>).<span class="at">append</span>(<span class="st">'&lt;script type=&quot;text/javascript&quot; src=&quot;/js/ie.js&quot;&gt;&lt;/scr'</span> <span class="op">+</span> <span class="st">'ipt&gt;'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="op">}</span></a>
<a class="sourceLine" id="cb1-6" title="6"><span class="op">}</span>)<span class="op">;</span></a></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="co">// Remove all CSS I don't want to use on IE</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="at">$</span>(<span class="st">'link[rel=stylesheet]'</span>).<span class="at">each</span>(<span class="kw">function</span>(i)</a>
<a class="sourceLine" id="cb2-3" title="3"><span class="op">{</span></a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="cf">if</span> (<span class="kw">this</span>.<span class="at">getAttribute</span>(<span class="st">'href'</span>) <span class="op">==</span> <span class="st">'/css/layout.css'</span>) </a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">this</span>.<span class="at">disabled</span> <span class="op">=</span> <span class="kw">true</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="cf">if</span> (<span class="kw">this</span>.<span class="at">getAttribute</span>(<span class="st">'href'</span>) <span class="op">==</span> <span class="st">'/css/shadows.css'</span>) </a>
<a class="sourceLine" id="cb2-7" title="7"> <span class="kw">this</span>.<span class="at">disabled</span> <span class="op">=</span> <span class="kw">true</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="cf">if</span> (<span class="kw">this</span>.<span class="at">getAttribute</span>(<span class="st">'href'</span>) <span class="op">==</span> <span class="st">'/css/gen.css'</span>) </a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">this</span>.<span class="at">disabled</span> <span class="op">=</span> <span class="kw">true</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-10" title="10"><span class="op">}</span>) <span class="op">;</span></a>
<a class="sourceLine" id="cb2-11" title="11"></a>
<a class="sourceLine" id="cb2-12" title="12"><span class="co">// Append the CSS for IE only</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="at">$</span>(<span class="st">'head'</span>).<span class="at">append</span>(<span class="st">'&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/ie.css&quot;/&gt;'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-14" title="14"></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">// I also add a message on top of the page</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="at">$</span>(<span class="st">'body'</span>).<span class="at">prepend</span>(<span class="st">'&lt;div id=&quot;iemessage&quot;&gt;&lt;p&gt;&lt;span class=&quot;fr&quot;&gt;&lt;em&gt;Avec &lt;a href=&quot;http://www.firefox.com&quot;&gt; Firefox &lt;/a&gt; et &lt;a href=&quot;http://www.apple.com/safari&quot;&gt;Safari&lt;/a&gt; cette page est bien plus jolie !&lt;/em&gt;&lt;/span&gt;&lt;span class=&quot;en&quot;&gt;&lt;em&gt;This page is far nicer with &lt;a href=&quot;http://www.firefox.com&quot;&gt; Firefox &lt;/a&gt; and &lt;a href=&quot;http://www.apple.com/safari&quot;&gt;Safari&lt;/a&gt;!&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;.&lt;/div&gt;'</span>)<span class="op">;</span></a></code></pre></div>
<p>Thats it.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-30-How-to-handle-evil-IE/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-30-How-to-handle-evil-IE/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-30
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Focus &gt; Minimalism</title>
<meta name="keywords" content="jQuery, design, web" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-Focus-vs-Minimalism/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Focus &gt; Minimalism</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I believe the goal researched by minimalism is <strong>Focus</strong>. But I dont believe minimalism should be the goal. Focus should be the goal, and I believe minimalism isnt necessary to reach it.</p>
<p>This is why my design is not minimalist, but I decided to remove most of the navigation stuff of all pages of my website. May be Ill prefer to hide the menu only when you are on blog article. For now, I hide the menu everywhere on the website.</p>
<hr />
<h2 id="technical-details">technical details</h2>
<p>For those who want the technical details behind the show/hide menu, here is the simple jQuery code.</p>
<p>The HTML:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;menuButton&quot;</span><span class="kw">&gt;&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;entete&quot;</span><span class="kw">&gt;</span>#content of the menu<span class="kw">&lt;/div&gt;</span></a></code></pre></div>
<p>The CSS:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode css"><code class="sourceCode css"><a class="sourceLine" id="cb2-1" title="1"><span class="pp">#menuButton</span> {</a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="kw">font-size</span>: <span class="dv">2</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="kw">height</span>: <span class="dv">2</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="kw">line-height</span>: <span class="dv">1.8</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">width</span>: <span class="dv">2</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">position</span>: <span class="dv">fixed</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-7" title="7"> <span class="kw">left</span>: <span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="kw">top</span>: <span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">z-index</span>: <span class="dv">9001</span> }</a>
<a class="sourceLine" id="cb2-10" title="10"></a>
<a class="sourceLine" id="cb2-11" title="11"><span class="pp">#menuButton</span><span class="in">:hover</span> {</a>
<a class="sourceLine" id="cb2-12" title="12"> <span class="kw">cursor</span>: <span class="dv">pointer</span><span class="op">;</span> }</a>
<a class="sourceLine" id="cb2-13" title="13"></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="pp">#entete</span> {</a>
<a class="sourceLine" id="cb2-15" title="15"> <span class="kw">top</span>: <span class="dv">5</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-16" title="16"> <span class="kw">left</span>: <span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-17" title="17"> <span class="kw">position</span>: <span class="dv">fixed</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-18" title="18"> <span class="kw">width</span>: <span class="dv">10</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-19" title="19"> <span class="kw">z-index</span>: <span class="dv">9000</span><span class="op">;</span> }</a></code></pre></div>
<p>The javascript code (using jQuery)</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb3-1" title="1"><span class="kw">function</span> <span class="at">hideMenu</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb3-2" title="2"> <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">animate</span>(<span class="op">{</span><span class="dt">left</span><span class="op">:</span><span class="st">&quot;-10em&quot;</span><span class="op">},</span> <span class="dv">500</span> )<span class="op">;</span></a>
<a class="sourceLine" id="cb3-3" title="3"> <span class="at">$</span>(<span class="st">'#menuButton'</span>).<span class="at">html</span>(<span class="st">'&amp;rarr;'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-4" title="4"><span class="op">}</span></a>
<a class="sourceLine" id="cb3-5" title="5"><span class="kw">function</span> <span class="at">showMenu</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">animate</span>(<span class="op">{</span><span class="dt">left</span><span class="op">:</span><span class="st">&quot;0em&quot;</span><span class="op">},</span> <span class="dv">500</span> )<span class="op">;</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="at">$</span>(<span class="st">'#menuButton'</span>).<span class="at">html</span>(<span class="st">'&amp;larr;'</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-8" title="8"><span class="op">}</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="kw">function</span> <span class="at">toggleMenu</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb3-10" title="10"> <span class="cf">if</span> ( <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">css</span>(<span class="st">'left'</span>)<span class="op">==</span><span class="st">'-10em'</span> ) <span class="op">{</span></a>
<a class="sourceLine" id="cb3-11" title="11"> <span class="at">showMenu</span>()<span class="op">;</span></a>
<a class="sourceLine" id="cb3-12" title="12"> <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span></a>
<a class="sourceLine" id="cb3-13" title="13"> <span class="at">hideMenu</span>()<span class="op">;</span></a>
<a class="sourceLine" id="cb3-14" title="14"> <span class="op">}</span></a>
<a class="sourceLine" id="cb3-15" title="15"><span class="op">}</span></a></code></pre></div>
<p>And the result is shown in the top left corner of this website.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-Focus-vs-Minimalism/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-Focus-vs-Minimalism/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-22
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - How to preload your site with style</title>
<meta name="keywords" content="web, jQuery, webdesign" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-How-to-preload-your-site-with-style/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>How to preload your site with style</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h2 id="example">Example</h2>
<p>Here is a live example of what appear while loading my pages.</p>
<script src="http://code.jquery.com/jquery-1.12.3.min.js"></script>
<div id="demo" style="width:45%; position: relative; height: 8em; background: #333; background-position: 50% 50%; color: #fff; text-align: center; padding-top: 1em; margin-left: auto; margin-right: auto; border: solid 10px rgba(255,255,255,0.7); -webkit-border-radius: 1em; -moz-border-radius: 1em; border-radius: 1em; cursor: pointer; ">
<p>
Hello! Ive finished loading!
</p>
<p>
Click me to see me disapear again.
</p>
<div id="todisapear" style="color: #000; position:absolute;top:0;left:0;text-align: center; padding-top: 1em; width: 100%; background-color: #eee; height: 8em;">
<p>Loading… <img style="border: none; background-color: none; background: none" src="../../../../Scratch/img/loading.gif" alt="loading logo" /></p>
</div>
<script>
function Rabbit(){
$('#todisapear')
.show()
.animate({opacity: 1.0},3000)
.fadeOut();
}
$(document).ready(function(){
$('#todisapear').animate({opacity: 1.0},3000).fadeOut();
$('#demo').click(Rabbit);
});
</script>
</div>
<p>I first tried to integrate <a href="http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/">queryLoader</a>, but it didnt fill my needs.</p>
<p>The plugin add a black div to hide all the content. But as the script had to be launched at the end of the source code my website show for a small time.</p>
<p>In order to hide this small artefact, here is how I do that.</p>
<h2 id="code">Code</h2>
<p>In a first time, I added at the top of the body the div hiding all the content.</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1">...</a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw">&lt;body&gt;</span></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;blackpage&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-4" title="4"> content to display during the loading.</a>
<a class="sourceLine" id="cb1-5" title="5"><span class="kw">&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb1-6" title="6">...</a></code></pre></div>
</div>
<p>and here is the associated CSS to <code>#blackpage</code>:</p>
<div>
<div class="sourceCode" id="cb2"><pre class="sourceCode css"><code class="sourceCode css"><a class="sourceLine" id="cb2-1" title="1"><span class="pp">#blackpage</span></a>
<a class="sourceLine" id="cb2-2" title="2"> top<span class="in">: 0 </span></a>
<a class="sourceLine" id="cb2-3" title="3"> left<span class="in">: 0 </span></a>
<a class="sourceLine" id="cb2-4" title="4"> width<span class="in">: 100%</span></a>
<a class="sourceLine" id="cb2-5" title="5"> height<span class="in">: 100%</span></a>
<a class="sourceLine" id="cb2-6" title="6"> margin-left<span class="in">: 0</span></a>
<a class="sourceLine" id="cb2-7" title="7"> margin-right<span class="in">: 0</span></a>
<a class="sourceLine" id="cb2-8" title="8"> margin-top<span class="in">: 0</span></a>
<a class="sourceLine" id="cb2-9" title="9"> margin-bottom<span class="in">: 0</span></a>
<a class="sourceLine" id="cb2-10" title="10"> position<span class="in">: absolute</span></a>
<a class="sourceLine" id="cb2-11" title="11"> text-align<span class="in">: center</span></a>
<a class="sourceLine" id="cb2-12" title="12"> color<span class="in">: #666</span></a>
<a class="sourceLine" id="cb2-13" title="13"> padding-top<span class="in">: 10em</span></a>
<a class="sourceLine" id="cb2-14" title="14"> background-color<span class="in">: #eee</span></a>
<a class="sourceLine" id="cb2-15" title="15"> z-index<span class="in">: 9000</span></a></code></pre></div>
</div>
<p>and the associated jQuery code:</p>
<div>
<div class="sourceCode" id="cb3"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb3-1" title="1"><span class="at">$</span>(document).<span class="at">ready</span>(<span class="kw">function</span>()<span class="op">{</span></a>
<a class="sourceLine" id="cb3-2" title="2"> <span class="at">$</span>(<span class="st">'#blackpage'</span>).<span class="at">fadeOut</span>()<span class="op">;</span></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="op">}</span>)<span class="op">;</span></a></code></pre></div>
</div>
<p>Yes, it is as simple as that. And, putting the <code>#blackpage</code> div at the top of my page, I ensure to hide anything while loading.</p>
<p>I hope it had helped you!</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-How-to-preload-your-site-with-style/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-How-to-preload-your-site-with-style/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-03
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Menu waiting to hide himself</title>
<meta name="keywords" content="jQuery, web, javascript, design" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Menu waiting to hide himself</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I discussed <a href="../../../../Scratch/en/blog/2009-10-Focus-vs-Minimalism">earlier why I prefer to hide my navigation menu</a>. I finally decided to hide it only after a short time. Just the time needed for a user to see it. But how make it disappear only when it is not used for some time?</p>
<p>Here is how to accomplish that easily.</p>
<p>HTML:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1"> <span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;menuButton&quot;</span><span class="kw">&gt;&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb1-2" title="2"> <span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;entete&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="kw">&lt;ul&gt;</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="kw">&lt;li&gt;</span> menu item 1 <span class="kw">&lt;/li&gt;</span></a>
<a class="sourceLine" id="cb1-5" title="5"> ...</a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="kw">&lt;li&gt;</span> menu item n <span class="kw">&lt;/li&gt;</span></a>
<a class="sourceLine" id="cb1-7" title="7"> <span class="kw">&lt;/ul&gt;</span></a>
<a class="sourceLine" id="cb1-8" title="8"> <span class="kw">&lt;/div&gt;</span></a></code></pre></div>
<p>CSS:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode css"><code class="sourceCode css"><a class="sourceLine" id="cb2-1" title="1"> <span class="pp">#entete</span> {</a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="kw">top</span>: <span class="dv">1</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="kw">left</span>: <span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="kw">position</span>: <span class="dv">fixed</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">width</span>: <span class="dv">10</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">z-index</span>: <span class="dv">2000</span><span class="op">;</span> }</a>
<a class="sourceLine" id="cb2-7" title="7"></a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="pp">#entete</span> {</a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">top</span>: <span class="dv">1</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-10" title="10"> <span class="kw">height</span>: <span class="dv">22</span><span class="dt">em</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-11" title="11"> <span class="kw">left</span>: <span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-12" title="12"> <span class="kw">position</span>: <span class="dv">fixed</span><span class="op">;</span></a>
<a class="sourceLine" id="cb2-13" title="13"> <span class="kw">width</span>: <span class="dv">10</span><span class="dt">em</span><span class="op">;</span> }</a></code></pre></div>
<p>Javascript:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb3-1" title="1"><span class="kw">var</span> last<span class="op">=</span><span class="dv">0</span><span class="op">;</span></a>
<a class="sourceLine" id="cb3-2" title="2"></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="co">// will hide the menu in 5 seconds</span></a>
<a class="sourceLine" id="cb3-4" title="4"><span class="co">// if the variable 'last' has not changed its value</span></a>
<a class="sourceLine" id="cb3-5" title="5"><span class="kw">function</span> <span class="at">autoHideMenu</span>(value) <span class="op">{</span></a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="at">setTimeout</span>(<span class="kw">function</span>()<span class="op">{</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="cf">if</span> ( last <span class="op">==</span> value ) <span class="op">{</span> <span class="at">hideMenu</span>()<span class="op">;</span> <span class="op">}</span></a>
<a class="sourceLine" id="cb3-8" title="8"> <span class="op">},</span><span class="dv">5000</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="op">}</span></a>
<a class="sourceLine" id="cb3-10" title="10"></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="at">$</span>(document).<span class="at">ready</span>( <span class="kw">function</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb3-12" title="12"> <span class="co">// show the menu when the mouse is on</span></a>
<a class="sourceLine" id="cb3-13" title="13"> <span class="co">// the good area</span></a>
<a class="sourceLine" id="cb3-14" title="14"> <span class="at">$</span>(<span class="st">'#menuButton'</span>).<span class="at">hover</span>(showMenu)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-15" title="15"></a>
<a class="sourceLine" id="cb3-16" title="16"> <span class="co">// If the mouse is on the menu change the</span></a>
<a class="sourceLine" id="cb3-17" title="17"> <span class="co">// value of 'last'</span></a>
<a class="sourceLine" id="cb3-18" title="18"> <span class="co">// try to hide the menu when the mouse </span></a>
<a class="sourceLine" id="cb3-19" title="19"> <span class="co">// go out off the menu.</span></a>
<a class="sourceLine" id="cb3-20" title="20"> <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">hover</span>(</a>
<a class="sourceLine" id="cb3-21" title="21"> <span class="kw">function</span>()<span class="op">{</span>last<span class="op">+=</span><span class="dv">1</span><span class="op">;},</span> </a>
<a class="sourceLine" id="cb3-22" title="22"> <span class="kw">function</span>()<span class="op">{</span><span class="at">autoHideMenu</span>(last)<span class="op">;}</span> )<span class="op">;</span></a>
<a class="sourceLine" id="cb3-23" title="23"> <span class="at">autoHideMenu</span>(<span class="dv">0</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-24" title="24"><span class="op">}</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-25" title="25"></a>
<a class="sourceLine" id="cb3-26" title="26"><span class="co">// show / hide menu functions details</span></a>
<a class="sourceLine" id="cb3-27" title="27"></a>
<a class="sourceLine" id="cb3-28" title="28"><span class="co">// move to the left</span></a>
<a class="sourceLine" id="cb3-29" title="29"><span class="kw">function</span> <span class="at">hideMenu</span>() <span class="op">{</span> </a>
<a class="sourceLine" id="cb3-30" title="30"> <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">animate</span>(<span class="op">{</span><span class="dt">left</span><span class="op">:</span><span class="st">&quot;-10em&quot;</span><span class="op">},</span> <span class="dv">500</span> )<span class="op">;</span> </a>
<a class="sourceLine" id="cb3-31" title="31"><span class="op">}</span></a>
<a class="sourceLine" id="cb3-32" title="32"></a>
<a class="sourceLine" id="cb3-33" title="33"><span class="co">// move to right and will try to hide in 5 sec.</span></a>
<a class="sourceLine" id="cb3-34" title="34"><span class="kw">function</span> <span class="at">showMenu</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb3-35" title="35"> <span class="at">$</span>(<span class="st">'#entete'</span>).<span class="at">animate</span>(<span class="op">{</span><span class="dt">left</span><span class="op">:</span><span class="st">&quot;0em&quot;</span><span class="op">},</span> <span class="dv">500</span> )<span class="op">;</span></a>
<a class="sourceLine" id="cb3-36" title="36"> last<span class="op">+=</span><span class="dv">1</span><span class="op">;</span></a>
<a class="sourceLine" id="cb3-37" title="37"> <span class="at">autoHideMenu</span>(last)<span class="op">;</span></a>
<a class="sourceLine" id="cb3-38" title="38"><span class="op">}</span></a></code></pre></div>
<p>Simple and lightweight. No timer (almost), no memory leak, no Date…</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-26
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - launch daemon from command line</title>
<meta name="keywords" content="zsh, shell, script, tip" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-launch-daemon-from-command-line/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>launch daemon from command line</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Here is a tip, I dont know why, but I almost always forgot how to do that.</p>
<p>When you want to launch a command and this command should not be killed after you close your terminal. Here is how to accomplish that from command line:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">nohup</span> cmd <span class="kw">&amp;</span></a></code></pre></div>
<p><small>where <code>cmd</code> is your command.</small></p>
<p>I let this command here for me and I wish it could also help someone.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-launch-daemon-from-command-line/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-launch-daemon-from-command-line/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-23
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,213 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Untaught Git usage</title>
<meta name="keywords" content="git, dcvs, programming" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-10-untaught-git-usage/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Untaught Git usage</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p><small> <em>I explain why I had so much difficulties to use Git. There is an “untaught rule” that make hard to work without. Until I read the good document. </em></small></p>
<p><small> <em> “Cheap branches” arent designed to be totally isolated branches but rather should follow a “Master Branch”. There is a </em>Standard Workflow<em> to follow. If you dont follow it, you prepare yourself with some hard time with Git.</em> </small></p>
<hr />
<h1 id="my-way-to-decentralisation">My way to decentralisation</h1>
<h3 id="from-svn-to-bazaar">From SVN to Bazaar</h3>
<p>I was a huge user of <a href="http://subversion.tigris.org">subversion (svn)</a>. Until the day I saw this <a href="http://www.youtube.com/watch?v=4XpnKHJAok8">video of Linus Torvald</a>. Where he explain Git and all advantages of <em>Decentralized Concurrent Versioning System</em>(<abbr title="Decentralized Concurrent Versioning System">DCVS</abbr>)</p>
<p>I must say I was completely convinced. And the more you learn about <abbr title="Decentralized Concurrent Versioning System">DCVS</abbr> the more you see good reason to use them.</p>
<p>I then needed a versioning system for my team. As they were not used to open source versioning system except those heavy, with a GUI and with and administrator<sup><a href="#note1"></a></sup></p>
<p>After some web searches, I founded three main choices:</p>
<ul>
<li><a href="http://git-scm.com">Git</a></li>
<li><a href="http://bazaar-vcs.org">Bazaar</a></li>
<li><a href="http://selenic.com/mercurial">Mercurial</a></li>
</ul>
<p>After trying each other I chosen Bazaar. It has the simplest User Interface<sup><a href="#note2">*</a></sup>. My choice was done.</p>
<h3 id="from-bazaar-to-git">From Bazaar to Git</h3>
<p>It was really natural to learn when coming from <em>subversion</em>. The <code>pull</code> command corresponding to <code>update</code>, <code>push</code> command to <code>commit</code>. Commands like <code>commit</code> and <code>update</code> are still there if you want to use an SVN <em>workflow</em>.</p>
<p>After some times, reading on many blogs, I realize Git is far more popular and by influent people.</p>
<p>I then decide to use Git in particular to <em>version</em> this current website. But after trying it, I found it difficult and couter intuitive (Ill speak a work about it later).</p>
<p>After calling for some help, when I say Bazaar is much simpler to learn, some people answer me that Git:</p>
<blockquote>
<p><em>SO-MUCH-EASY my 12 year old daughter uses it to version its school documents. She has no difficulties at all, creating branches, blah, blah, blah…</em></p>
</blockquote>
<p>If a 12 years old girl has no problem with Git and I (with my Computer Science Ph.D.) have difficulties to uses it like I want, it is frustrating and humiliating. But what makes Git natural for some people and confusing for me?</p>
<p>I finally understood why reading a document I didnt read before. It was the <em>untaught</em> part of the conception. The part every developer found so <em>natural</em> it is not necessary to say a word about it. But it was not <em>natural</em> for me.</p>
<p><small><a name="note1"></a> - I speak about <em>ClearCase(c)</em>. I know there exists command line tools. But it was not the way my team used it.</small></p>
<p><small><a name="note2">*</a> - I never really given its chance to Mercurial. The terminology they chosen was too far from the svn one. And I was used to it.</small></p>
<hr />
<p>When you see explanation about <em>branches</em> and <abbr title="Decentralized Concurrent Versioning System">DCVS</abbr> we imagine each branch is totally uncorrelated to each other, except when <em>merging</em>. Everything is magic. This is the “<em>Parallel World</em>” explanation. This way of seeing is explained more in depth in the <a href="http://betterexplained.com/articles/a-visual-guide-to-version-control/">real good article about branches</a> on betterexplained.</p>
<p>Git was designed to manage the Linux Kernel. Git was designed using the concept of <em>Patch</em> instead of <em>Parallel Worlds</em>.</p>
<p>From one site <em>Parallel World</em> and <em>Patches</em> from the other. There is many equivalent notions in the two point of vue, but also some differences.</p>
<ul>
<li>Bazaar seems base on the <em>Parallel World</em> vision which implies <em>Patches</em></li>
<li>While Git seem base on the <em>Patch</em> model which will implie the creation of <em>Parallel Worlds</em>.</li>
</ul>
<p>I will not argument about which is the best. Just tell my vision of DCVS come from the <em>Parallel World</em> vision and Git was designed the other way<sup><a href="#note3"></a></sup>.</p>
<h2 id="from-theory-to-real-life-usage">From Theory to Real Life Usage</h2>
<p>I believe I understood conceptual mechanism under Git. But I had some difficulties with real usage. The worst point, the one I didnt get before long was because I didnt get really well the notion of <em>Cheap Branching</em>.</p>
<p>What is a <em>Cheap Branch</em>? If like me you come from Bazaar, it is a totally new notion. It is in fact the ability to create a branches all of them using the same directory.</p>
<p>You just have to launch a Git command and the local directory reflect the state of the branch you selected.</p>
<p>In theory, <em>Cheap Branches</em> are exactly like Bazaar branches. The word used is <em>Branch</em> and not <em>Cheap Branch</em>. But there is a slight difference between them. A slight difference between a <em>Cloned Branch</em> and a <em>Cheap Branch</em>.</p>
<p>A “Standard branch” is what is theoretically a kind of new <em>Parallel World</em>. But <em>Cheap branch</em> was designed to be future <em>Patch</em> for the main branch of the directory/Cloned branch.</p>
<p>Of course, I know anybody can state you can totally use <em>Cheap branches</em> as <em>Cloned branches</em>. But they werent designed for that. On daily usage, it is a bit uneasy to use it like this.</p>
<p>Here how Git <em>cheap branches</em> should be used (for more details see <a href="http://hoth.entp.com/output/git_for_designers.html">Git for Designers</a>):</p>
<ul>
<li>get or creation of a main repositoy <strong><sc>The Great Repository</sc></strong></li>
<li>creation of a <em>Cheap branch</em> containing differences which <strong>have</strong> to be patched somewhere in the future into <strong><sc>The Great Repository</sc></strong></li>
</ul>
<p>Heres how you should <strong>not</strong> use Git:</p>
<ul>
<li>Get or creation of a repository</li>
<li>Create a <em>cheap branch</em> which will never push its modification to the main repository.</li>
</ul>
<p>This simple minor difference of point of view confused me a lot.</p>
<h3 id="real-life-usage">Real Life Usage</h3>
<p>Now I have understood all that. I understand why Git has some many people claiming it is the best DCVS.</p>
<p>Cheap branching notion is essential in Git and is a really useful feature. Particularly for this website. But, there are not exactly, completely parallel line of development. Because they are designed to path the main branch. Of course, it is not an obligation, but there are slight messages which tell you this should be used like that.</p>
<p>If I want to separate in a better way some branches I just have to <em>Clone</em> them. And I return exactly in branches Bazaar provided me.</p>
<h3 id="examples">Examples</h3>
<p>For now, I prefer (from far) Bazaar terminology. They are cleaner and more understandable.</p>
<div>
<code class="zsh">bzr revert</code>
</div>
<p>Is clearer than</p>
<div>
<code class="zsh">git reset hard HEAD</code>
</div>
<p>We can tell the same thing about</p>
<div>
<code class="zsh">bzr revert -r -3</code>
</div>
<p>which seems preferable to</p>
<div>
<code class="zsh">git reset hard HEAD~3</code>
</div>
<p>Until now, it is not big business. But now, things will go worse. If we want to revert time on all the tree we use the keyword <code>reset</code>.</p>
<center>
OK
</center>
<p>Now, if I want to revert time on on file. We should naturally imagine the command will be:</p>
<div>
<code class="zsh">git reset hard FILE</code>
</div>
<center>
<strong>OF COURSE NOT!</strong>
</center>
<p>The solution is:</p>
<div>
<code class="zsh">git checkout FILE</code>
</div>
<p>What? <strong><code>checkout</code></strong> !? Well, ok. I accept. why not? With Bazaar it is:</p>
<div>
<code class="zsh">git revert FILE</code>
</div>
<p>What I personally found far more natural.</p>
<p>But the command to change the current <em>cheap branch</em> is really hard to be accepted (from the User Interface point of view). With Bazaar it is:</p>
<div>
<code class="zsh">cd ../branch</code>
</div>
<p>Well yes. With Bazaar you have to change your directory to change your branch. It needs more disk resources but it is really clear. Which is my current branch, is just a <code>pwd</code> away. For Git here is the command:</p>
<div>
<code class="zsh">git checkout branch</code>
</div>
<p><strong>WTF?</strong> I believed <code>checkout</code> was the key to get a file in some state (not the entire tree).</p>
<p>Then <code>checkout</code> is the same keyword used to get back in time on a file (BUT NOT ON ALL THE TREE where you have to use <code>reset --hard</code>) and to <strong>change current branch</strong>!</p>
<p>It is totally unnatural. Even if it is theoretically totally justified like you can see in the really good article <a href="http://eagain.net/articles/git-for-computer-scientists/">Git for Computer Scientist</a>. From the user point of vue, it is difficult to do worse than that. It is like somebody made it on purpose to make it the hardest possible to learn and understand.</p>
<blockquote>
<ul>
<li>— Try to find the good keyword for this operation</li>
<li>— Wrong! Try again!</li>
<li>— False, it is not yet right!</li>
</ul>
</blockquote>
<p>That were the Git bad side. But It has many advantages. Once youve understood the <em>cheap branching</em> paradigm. All became clearer for me after. Even if there is also some difficulties with the edit of the <code>.git/config</code> files (not user friendly at all).</p>
<p><small><a name="note3"></a> I must precise that I worked a lot with multi-modal logic and particularly about “Temporal Logics” (linear or not). This is why I was more inclined to see things this way. “Ah ! Just to remember my firsts love with computer science !”</small></p>
<hr />
<h1 id="conclusion">Conclusion</h1>
<h3 id="dcvs-vs.-cvs">DCVS vs. CVS ?</h3>
<p>Was it a good idea to change to a <em>decentralised</em> versionning system? Clearly yes. Decentralisation give far much great possibilities. Such as working on a fix on a totally isolated branches.</p>
<h3 id="is-git-better-than-bazaar">Is Git better than Bazaar?</h3>
<p>Speaking about <em>features</em> Ill tell Git is the best. But Git was too much in my way. Is was exactly what I didnt want for my first DCVS.</p>
<p>I shouldnt have had those difficulties about understanding <em>cheap branching which must be a patch</em>. In reality, Git make a difference between the Tree and the Branch. Which is obviously not the case for Bazaar. Conceptually, bazaar is simpler to understand.</p>
<h3 id="finally">Finally</h3>
<p>In conclusion, I use Git more often than Bazaar and I must say, that I have some preferences for Git. However, Git lack hardly clear commands name like <code>revert</code>. For now I dont made alias to correct that. But may be one day I should do that.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-untaught-git-usage/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-10-untaught-git-usage/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-10-13
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,19 @@
[color]
branch = auto
diff = auto
status = auto
[alias]
st = status
co = checkout
br = branch
lg = log --pretty=oneline --graph
logfull = log --pretty=fuller --graph --stat -p
unstage = reset HEAD
# there should be an article on what this command do
uncommit = !zsh -c '"if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i<=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \"revert to $0 version(s) back\""'
undomerge = reset --hard ORIG_HEAD
conflict = !gitk --left-right HEAD...MERGE_HEAD
# under Mac OS X, you should use gitx instead
# conflict = !gitx --left-right HEAD...MERGE_HEAD
[branch]
autosetupmerge = true

View file

@ -0,0 +1,452 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Git for n00b</title>
<meta name="keywords" content="git" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-11-12-Git-for-n00b/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Git for n00b</h1>
<h2>introduction</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div class="intro">
<p>A detailed tutorial of <a href="http://git-scm.org">Git</a> for people knowing very few about versions systems. Youll understand utility of such program and how we use modern version control system. I try to stay as pragmatic as possible.</p>
</div>
<hr />
<h1 id="begin-with-conclusion">Begin with conclusion</h1>
<p>Here is the list of sufficient and necessary command to use <a href="http://git-scm.org" title="Git">Git</a>. There is very few. It is normal not to understand immediately but it is to gives you an idea. Even if this article is long, 95% of <a href="http://git-scm.org" title="Git">Git</a> usage is in these 7 commands:</p>
<p>Get a project from the web:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1">git <span class="kw">clone</span> ssh://server/path/to/project</a></code></pre></div>
<p>Everyday <a href="http://git-scm.org" title="Git">Git</a> usage:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb2-1" title="1"><span class="co"># get modifications from other</span></a>
<a class="sourceLine" id="cb2-2" title="2">git pull</a>
<a class="sourceLine" id="cb2-3" title="3"><span class="co"># read what was done</span></a>
<a class="sourceLine" id="cb2-4" title="4">git <span class="kw">log</span></a>
<a class="sourceLine" id="cb2-5" title="5"></a>
<a class="sourceLine" id="cb2-6" title="6"><span class="co"># Make local changes to files </span></a>
<a class="sourceLine" id="cb2-7" title="7">hack, hack, hack...</a>
<a class="sourceLine" id="cb2-8" title="8"><span class="co"># list the modified files</span></a>
<a class="sourceLine" id="cb2-9" title="9">git status</a>
<a class="sourceLine" id="cb2-10" title="10"><span class="co"># show what I've done</span></a>
<a class="sourceLine" id="cb2-11" title="11">git <span class="kw">diff</span></a>
<a class="sourceLine" id="cb2-12" title="12"></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co"># tell git to version a new file</span></a>
<a class="sourceLine" id="cb2-14" title="14">git add new/file</a>
<a class="sourceLine" id="cb2-15" title="15"></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co"># commit its own modifications </span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co"># to its local branch</span></a>
<a class="sourceLine" id="cb2-18" title="18">git commit -a -m <span class="st">&quot;Fix bug #321&quot;</span></a>
<a class="sourceLine" id="cb2-19" title="19"></a>
<a class="sourceLine" id="cb2-20" title="20"><span class="co"># send local modifications to other</span></a>
<a class="sourceLine" id="cb2-21" title="21">git push</a></code></pre></div>
<p>This article is written for people knowing very few about versionning systems. It is also written for those who had didnt followed progress since CVS or subversion (SVN). This is why, in a first time Ill explain quickly which are the goal of such systems. Secondly, Ill explain how to install and configure <a href="http://git-scm.org" title="Git">Git</a>. Then, I give the command for each feature a <abbr title="Decentralized Concurent Versions System">DCVS</abbr> must have.</p>
<h1 id="gitgit-for-what"><a href="http://git-scm.org" title="Git">Git</a> for what?</h1>
<div class="intro">
<p>If you just want to use <a href="http://git-scm.org" title="Git">Git</a> <strong>immediately</strong>, just read dark part. You read this part later to understand correctly foundations of version systems and not doing strange things.</p>
</div>
<p><a href="http://git-scm.org" title="Git">Git</a> is a <abbr title="Decentralized Concurent Versions System">DCVS</abbr>, which means a Decentralized Concurrent Versions System. Lets analyze each part of this long term:</p>
<h3 id="versions-system">Versions System</h3>
<p>Firstly, versions system manage files. When somebody work with files without a versions system, the following happens frequently:</p>
<p>When you modify a somehow critical file you dont want to loose. You copy naturally this file with another name. For example:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb3-1" title="1">$ <span class="kw">cp</span> fichier_important.c fichier_important.c.bak</a></code></pre></div>
<p>In consequence of what, the new file, play the role of <em>backup</em>. If you break everything, you can always return in the last state by overwriting your modifications. Of course, this method is not very professional and is a bit limited. If you make many modifications, youll end with many files with strange names like:</p>
<div>
<div class="sourceCode" id="cb4"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb4-1" title="1">fichier_important.c.bak</a>
<a class="sourceLine" id="cb4-2" title="2">fichier_important.c.old</a>
<a class="sourceLine" id="cb4-3" title="3">fichier_important.c.Bakcup</a>
<a class="sourceLine" id="cb4-4" title="4">fichier_important.c.BAK.2009-11-14</a>
<a class="sourceLine" id="cb4-5" title="5">fichier_important.c.2009.11.14</a>
<a class="sourceLine" id="cb4-6" title="6">fichier_important.c.12112009</a>
<a class="sourceLine" id="cb4-7" title="7">old.fichier_important.c</a></code></pre></div>
</div>
<p>If you want to make it works correctly, youll have to use naming convention. Files take many place even if you modify most of time only some lines.</p>
<p><em>Fortunately, versions system are here to help.</em></p>
<p>You only have to signal you want a new version of a file and the versions system will do the job for you. It will record the backup where it could be easily recovered. Generally, systems version do it better than you, making the backup only of the modified lines and not the total file.</p>
<p>Once upon a time versions were managed for each file separately. I think about CVS. Then it naturally appears projects are a coherent set of files. Recover each file separately was a tedious work. This is why versions number passed from files to the entire project.</p>
<p>It is therefore possible to say, “I want to get back three days earlier”.</p>
<div class="black">
<p><em>What gives versions system?</em> (I didnt mention everything at all)</p>
<ul>
<li>automatic backups: <em>back in time</em>,</li>
<li>gives the ability to see differences between each version,</li>
<li>put a <em>tag</em> on some version to be able to refer to them easily,</li>
<li>gives the ability to see an historic of all modifications. Generally the user must add a comment for each new version.</li>
</ul>
</div>
<h3 id="concurrent">concurrent:</h3>
<p>Version Systems are already useful to manage its own projects. They help to organize and resolve partially backup problems. I say partially because you have to backup your repository on a decent file system. But versions system are really interesting is on projects done by many people.</p>
<p>Lets begin by an example, a two person project ; Alex and Beatrice. On a file containing a <em>Lovecraft</em>s gods list:</p>
<div style="width: 10em; margin-left: auto; margin-right: auto">
<div class="sourceCode" id="cb5"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb5-1" title="1">Cthulhu</a>
<a class="sourceLine" id="cb5-2" title="2">Shubniggurath</a>
<a class="sourceLine" id="cb5-3" title="3">Yogsototh</a></code></pre></div>
</div>
Say Alex is home and modify the file:
<div style="width: 10em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Cthulhu
Shubniggurath
<span class="StringConstant"><strong>Soggoth</strong></span>
Yogsototh
</pre>
</div>
<p>after that he send the file on the project server. Then on the server there is the Alex file:</p>
<p>A bit later, Beatrice who had not get the Alex file on the server make the modification:</p>
<div style="width: 10em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Cthulhu
<span class="Constant"><strong>Dagon</strong></span>
Shubniggurath
Yogsototh
</pre>
</div>
<p>Beatrice send her file on the server</p>
<p>Alex modification is <em>lost</em>. One more time, versions system are here to help.</p>
<p>A version system would had <em>merge</em> the two files at the time Beatrice send the file on the server. And like by magic, on the server the file would be:</p>
<div style="width: 10em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Cthulhu
<span class="Constant"><strong>Dagon</strong></span>
Shubniggurath
<span class="StringConstant"><strong>Soggoth</strong></span>
Yogsototh
</pre>
</div>
<p>In real life, at the moment Beatrice want to send her modifications, the versions system alert her a modification had occurred on the server. Then she uses a command which pull the modification from the server to her local computer. And this command update her file. After that, Beatrice send again the new file on the server.</p>
<div class="black">
<p><strong>In what Concurrent Versions System help?</strong></p>
<ul>
<li>get without any problem others modifications,</li>
<li>send without any problem its own modifications to others,</li>
<li>manage conflicts. I didnt speak about it, but sometimes a conflict can occur (when two different people modify the same line on a file for example). SVC help to resolve such problem. More on that later,</li>
<li>help to know who done what and when.</li>
</ul>
</div>
<h3 id="decentralized">decentralized</h3>
<p>This word became popular only recently about CVS. And it mainly means two things:</p>
<p>First, until really recently (SVN), youll have to be connected to the distant server to get informations about a project. Like get the history. New decentralized systems work with a local <em>REPOSITORY</em> (directory containing backups and many informations linked to the versions system functionalities). Hence, one can view the history of a project without the need of being connected.</p>
<p>All instances of a project can live <em>independently</em>.</p>
<p>To be more precise, DCVS are base on the <em>branch</em> notion.</p>
<p>Practically, it has great importance. It means, everybody work separately, and the system help to glue all their work.</p>
<p>It is even more than just that. It help to code independently each feature and bug fixes. Under other system it was far more difficult.</p>
<p>Typical example:</p>
<blockquote>
<p>I develop my project. Im ameliorating something. An urgent bug is reported.</p>
<p>With a DCVS I can easily, get back to the version with the bug. Fix it. Send the fix. Get back to my feature work. And even, use the fix for the new version with my new feature.</p>
<p>In a not decentralized version system, doing such a thing is possible but not natural. Decentralization means it become natural to use a branch for each separable work.</p>
</blockquote>
<div class="black">
<p><strong>Advantages given by DCVS:</strong></p>
<ul>
<li>Ability to work offline,</li>
<li>Ability to create many <em>atomic</em> patches,</li>
<li>Help the maintenance of many different versions of the same application.</li>
</ul>
</div>
<h2 id="to-resume">To resume</h2>
<p>Lets resume what we can easily do with DCVS:</p>
<p><strong>Versions Systems</strong></p>
<ul>
<li>back in time,</li>
<li>list differences between versions,</li>
<li>name some versions to refer to them easily</li>
<li>show history of modifications</li>
</ul>
<p><strong>Concurrent</strong></p>
<ul>
<li>get others modifications,</li>
<li>send its modifications to others,</li>
<li>know who done what and when,</li>
<li>conflicts management.</li>
</ul>
<p><strong>Decentralized</strong></p>
<ul>
<li>Easily manipulate branches</li>
</ul>
<p>Now lets see how to obtain all these things easily with <a href="http://git-scm.org" title="Git">Git</a>.</p>
<h1 id="before-usage-configuration">Before usage, configuration</h1>
<h2 id="install">install</h2>
<p>Under Linux Ubuntu or Debian:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb6-1" title="1">$ <span class="kw">sudo</span> apt-get <span class="kw">install</span> git</a></code></pre></div>
<p>Under Mac OS X:</p>
<ul>
<li>install <a href="http://macports.org/install.php">MacPorts</a></li>
<li>install <a href="http://git-scm.org" title="Git">Git</a></li>
</ul>
<div class="sourceCode" id="cb7"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb7-1" title="1">$ <span class="kw">sudo</span> port selfupdate</a>
<a class="sourceLine" id="cb7-2" title="2"></a>
<a class="sourceLine" id="cb7-3" title="3">$ <span class="kw">sudo</span> port <span class="kw">install</span> git-core</a></code></pre></div>
<h2 id="global-configuration">Global configuration</h2>
<p>Save the following file as your <code>~/.gitconfig</code>.</p>
<pre><code>[color]
branch = auto
diff = auto
status = auto
[alias]
st = status
co = checkout
br = branch
lg = log --pretty=oneline --graph
logfull = log --pretty=fuller --graph --stat -p
unstage = reset HEAD
# there should be an article on what this command do
uncommit = !zsh -c '&quot;if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i&lt;=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \&quot;revert to $0 version(s) back\&quot;&quot;'
undomerge = reset --hard ORIG_HEAD
conflict = !gitk --left-right HEAD...MERGE_HEAD
# under Mac OS X, you should use gitx instead
# conflict = !gitx --left-right HEAD...MERGE_HEAD
[branch]
autosetupmerge = true</code></pre>
<p>You can achieve the same result using for each entry the command: <code>git config --global</code>. Next, configure your name and your email. For example, if your name is John Doe and your email is <code>john.doe@email.com</code>. Launch the following commands:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb9-1" title="1">$ git config --global user.name John Doe</a>
<a class="sourceLine" id="cb9-2" title="2"></a>
<a class="sourceLine" id="cb9-3" title="3">$ git config --global user.email john.doe@email.com</a></code></pre></div>
<p>Here it is. Base configuration is over. The file containing alias will help to type shorter commands.</p>
<h2 id="get-a-project">Get a project</h2>
<p>If a project is already versionned with <a href="http://git-scm.org" title="Git">Git</a> you should have an <code>URL</code> of the sources. Then use the following command:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb10-1" title="1">$ <span class="kw">cd</span> ~/Projets</a>
<a class="sourceLine" id="cb10-2" title="2">$ git <span class="kw">clone</span> git://main.server/path/to/file</a></code></pre></div>
<p>If there is no git server but youve got an <code>ssh</code> access. Just replace the <code>git://host</code> by <code>ssh://user@host</code>. In order not to type your password each time, use:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb11-1" title="1">$ <span class="kw">ssh-keygen</span> -t rsa</a></code></pre></div>
<p>Reply to question and <strong>do not enter</strong> a password. Then copy your keys to the distant server. This is not the safest way to do this. The safest being, using <code>ssh-agent</code>.</p>
<p>The easiest way if you have <code>ssh-copy-id</code>:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb12-1" title="1">me@locahost$ ssh-copy-id ~/.ssh/id_rsa.pub me@main.server</a></code></pre></div>
<p>or manually</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb13-1" title="1">me@locahost$ <span class="kw">scp</span> ~/.ssh/id_rsa.pub me@main.server:</a>
<a class="sourceLine" id="cb13-2" title="2">me@locahost$ <span class="kw">ssh</span> me@main.server</a>
<a class="sourceLine" id="cb13-3" title="3">password:</a>
<a class="sourceLine" id="cb13-4" title="4">me@main.server$ <span class="kw">cat</span> id_rsa.pub <span class="kw">&gt;&gt;</span> ~/.ssh/authorized_keys</a>
<a class="sourceLine" id="cb13-5" title="5">me@main.server$ <span class="kw">rm</span> id_rsa.pub</a>
<a class="sourceLine" id="cb13-6" title="6">me@main.server$ <span class="kw">logout</span></a></code></pre></div>
<p>Now you dont need to write your password to access the <code>main.server</code>.</p>
<h2 id="creating-a-new-project">Creating a new project</h2>
<p>Suppose you already have a project with files. Then it is really easy to version it.</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb14-1" title="1">$ <span class="kw">cd</span> /path/to/project</a>
<a class="sourceLine" id="cb14-2" title="2">$ git init</a>
<a class="sourceLine" id="cb14-3" title="3">$ git add <span class="kw">.</span></a>
<a class="sourceLine" id="cb14-4" title="4">$ git commit -m <span class="st">&quot;Initial commit&quot;</span></a></code></pre></div>
<p>Let do a small remark. If you dont want to <em>version</em> every file. Typically intermediate compilation file, swap files… Then you need to exclude them. Just before launching the <code>git add .</code> command. You need to create a <code>.gitignore</code> file in the root directory of your project. This file will contain all exclude <em>pattern</em>. For example:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb15-1" title="1">*.o</a>
<a class="sourceLine" id="cb15-2" title="2">*.bak</a>
<a class="sourceLine" id="cb15-3" title="3">*.swp</a>
<a class="sourceLine" id="cb15-4" title="4">*~</a></code></pre></div>
<p>Now, if you want to create a repository on a distant server, it <em>must</em> not be in <code>bare</code> mode. The repository will contain only versionning informations, but not the files of the project. To achieve that:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb16-1" title="1">$ <span class="kw">cd</span> /path/to/local/project</a>
<a class="sourceLine" id="cb16-2" title="2">$ git <span class="kw">clone</span> --bare <span class="kw">.</span> ssh://server/path/to/project</a></code></pre></div>
<p>Others will be able to get your modifications.</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb17-1" title="1">git <span class="kw">clone</span> ssh://server/path/to/project</a></code></pre></div>
<h2 id="abstract-of-the-second-step">Abstract of the second step</h2>
<p>You now have a local directory on your computer. It is versionned and you can say it is, because there is a <code>.git</code> directory at the root (and the root only) of your project. This directory contain all necessary informations for <a href="http://git-scm.org" title="Git">Git</a> to version your project.</p>
<p>Now you only need to know how to use it.</p>
<h1 id="here-we-go">Here we go!</h1>
<p>Here is one from many way to use <a href="http://git-scm.org" title="Git">Git</a>. This method is sufficient to work on a project. Not there is many other <em>workflows</em>.</p>
<h2 id="basic-usage">Basic usage</h2>
<p>Work with <a href="http://git-scm.org" title="Git">Git</a> immediately:</p>
<ul>
<li>Get modification done by others <code>git pull</code>,</li>
<li>See details of these modifications <code>git log</code>,</li>
<li>Many times:
<ul>
<li><em>Make an atomic modification</em></li>
<li>Verify details of this modification: <code>git status</code> and <code>git diff</code>,</li>
<li>Add some file to be versionned if necessary:<br /><code>git add [file]</code>,</li>
<li>Save you modifications <br /><code>git commit -a -m "message"</code>,</li>
<li>Send your modifications to others: <code>git push</code> (redo a <code>git pull</code> if push return an error).</li>
</ul></li>
</ul>
<p>With these few commands you can use <a href="http://git-scm.org" title="Git">Git</a>. Even if it is sufficient, you need to know one more thing before really begin ; How to manage <em>conflicts</em>.</p>
<h3 id="conflicts-management">Conflicts management</h3>
<p>Conflicts can arise when you change the same line of code on the same file from another branch youre merging. It can seems a bit intimidating, but with <a href="http://git-scm.org" title="Git">Git</a> this kind of thing is really simple to handle.</p>
<h4 id="example">example</h4>
<p>You start from the following file</p>
<div style="width: 18em; margin-left: auto; margin-right: auto">
<div class="sourceCode" id="cb18"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb18-1" title="1">Zoot </a></code></pre></div>
</div>
<p>and you modify one line</p>
<div style="width: 18em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Zoot <span class="Constant"><strong>the pure</strong></span>
</pre>
</div>
<p>except during this time, another user had also modified the same line and had done a <code>push</code>.</p>
<div style="width: 18em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Zoot<span class="StringConstant"><strong>, just Zoot</strong></span>
</pre>
</div>
<p>Now when you do a:</p>
<div>
<div class="sourceCode" id="cb19"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb19-1" title="1">$ git pull</a>
<a class="sourceLine" id="cb19-2" title="2">remote: Counting objects: 5, <span class="kw">done</span>.</a>
<a class="sourceLine" id="cb19-3" title="3">remote: Total 3 <span class="kw">(</span>delta 0<span class="kw">)</span>, reused 0 <span class="kw">(</span>delta 0<span class="kw">)</span></a>
<a class="sourceLine" id="cb19-4" title="4">Unpacking objects: 100% <span class="kw">(</span>3/3<span class="kw">)</span>, <span class="kw">done</span>.</a>
<a class="sourceLine" id="cb19-5" title="5">From /home/yogsototh/tmp/conflictTest</a>
<a class="sourceLine" id="cb19-6" title="6"> d3ea395..2dc7ffb master <span class="kw">-&gt;</span> origin/master</a>
<a class="sourceLine" id="cb19-7" title="7">Auto-merging foo</a>
<a class="sourceLine" id="cb19-8" title="8">CONFLICT <span class="kw">(</span>content<span class="kw">):</span> Merge conflict <span class="kw">in</span> foo</a>
<a class="sourceLine" id="cb19-9" title="9">Automatic merge failed; fix conflicts and <span class="kw">then</span> commit the result.</a></code></pre></div>
</div>
<p>Our file <code>foo</code> now contains:</p>
<div>
<pre class="twilight">
<<<<<<< HEAD:foo
Zoot <span class="Constant"><strong>the pure</strong></span>
=======
<span>Zoot<span class="StringConstant"><strong>, just Zoot</strong></span></span>
>>>>>>> 2dc7ffb0f186a407a1814d1a62684342cd54e7d6:foo
</pre>
</div>
<h4 id="conflict-resolution">Conflict resolution</h4>
<p>To resolve the conflict you only have to edit the file for example, writing:</p>
<div style="width: 18em; margin-left: auto; margin-right: auto">
<pre class="twilight">
Zoot <span class="Constant"><strong>the not so pure</strong></span>
</pre>
</div>
<p>and to commit</p>
<div>
<div class="sourceCode" id="cb20"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb20-1" title="1">git commit -a -m <span class="st">&quot;conflict resolved&quot;</span></a></code></pre></div>
</div>
<p>Now youre ready to use <a href="http://git-scm.org" title="Git">Git</a>. <a href="http://git-scm.org" title="Git">Git</a> provide many other functionnalities. Now well see some <a href="http://git-scm.org" title="Git">Git</a> usages older CVS couldnt handle.</p>
<h1 id="why-git-is-cool">Why Git is cool?</h1>
<p>Because with <a href="http://git-scm.org" title="Git">Git</a> you can work on many part of some project totally independently. This is the true efficiency of decentralisation.</p>
<p>Each branch use the same directory. Then you can easily change your branch. You can also change branch when some files are modified. You can then dispatch your work on many different branches and merge them on one master branch at will.</p>
<p>Using the <code>git rebase</code> you can decide which modifications should be forget or merged into only one modification.</p>
<p>What does it mean for real usage? You can focus on coding. For example, you can code, a fix for bug b01 and for bug b02 and code a feature f03. Once finished you can create a branch by bug and by feature. And finally you can merge these modifications on a main branch.</p>
<p>All was done to code and decide how to organize your versions after. In other VCS it is not as natural as in <a href="http://git-scm.org" title="Git">Git</a>.</p>
<p>With <a href="http://git-scm.org" title="Git">Git</a> you can depend of many different sources. Then, there is not necessarily a master repository where everybody puts its modifications.</p>
<p>What changes the most with <a href="http://git-scm.org" title="Git">Git</a> when you come from SVN, its the idea of a centralized project on one server. With <a href="http://git-scm.org" title="Git">Git</a> many people could work on the same project but not necessarily on the same <em>repository</em> as main reference. One can easily fix a bug and send a patch to many different versions of a project.</p>
<h1 id="command-list">Command List</h1>
<h2 id="command-for-each-functionality">Command for each functionality</h2>
<p>In the first part, we saw the list of resolved problem by <a href="http://git-scm.org" title="Git">Git</a>. To resume <a href="http://git-scm.org" title="Git">Git</a> should do:</p>
<ul>
<li>get others modifications,</li>
<li>send modifications to others,</li>
<li>get back in time,</li>
<li>list differences between each version,</li>
<li>name some versions in order to refer easily to them,</li>
<li>write an historic of modifications,</li>
<li>know who did what and when,</li>
<li>manage conflicts,</li>
<li>easily manage branches.</li>
</ul>
<h3 id="get-others-modifications">get others modifications</h3>
<div class="sourceCode" id="cb21"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb21-1" title="1">$ git pull</a></code></pre></div>
<h3 id="send-modifications-to-others">send modifications to others</h3>
<div class="sourceCode" id="cb22"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb22-1" title="1">$ git push</a></code></pre></div>
<p>or more generally</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb23-1" title="1">$ git pull</a>
<a class="sourceLine" id="cb23-2" title="2">$ git push</a></code></pre></div>
<h3 id="get-back-in-time">get back in time</h3>
<h4 id="for-all-tree">For all tree</h4>
<div class="sourceCode" id="cb24"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb24-1" title="1">$ git checkout</a></code></pre></div>
<div class="sourceCode" id="cb25"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb25-1" title="1">$ git revert</a></code></pre></div>
<p>revert three version before (see my <code>.gitconfig</code> file).</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb26-1" title="1">$ git uncommit 3</a></code></pre></div>
<p>Undo the las merge (if something goes wrong)</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb27-1" title="1">$ git revertbeforemerge</a></code></pre></div>
<h4 id="for-one-file">For one file</h4>
<div class="sourceCode" id="cb28"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb28-1" title="1">$ git checkout <span class="kw">file</span></a>
<a class="sourceLine" id="cb28-2" title="2">$ git checkout VersionHash <span class="kw">file</span></a>
<a class="sourceLine" id="cb28-3" title="3">$ git checkout HEAD~3 <span class="kw">file</span></a></code></pre></div>
<h3 id="list-differences-between-each-version">list differences between each version</h3>
<p>list files being modified</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb29-1" title="1">$ git status</a></code></pre></div>
<p>differences between last version files and local files</p>
<div class="sourceCode" id="cb30"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb30-1" title="1">$ git <span class="kw">diff</span></a></code></pre></div>
<p>differences between some version and local files</p>
<div class="sourceCode" id="cb31"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb31-1" title="1">$ git <span class="kw">diff</span> VersionHash fichier</a></code></pre></div>
<h3 id="name-some-version-to-refer-to-them-in-the-future">name some version to refer to them in the future</h3>
<div class="sourceCode" id="cb32"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb32-1" title="1">$ git tag <span class="st">'toto'</span></a></code></pre></div>
<h3 id="show-historic-of-modifications">show historic of modifications</h3>
<div class="sourceCode" id="cb33"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb33-1" title="1">$ git <span class="kw">log</span></a>
<a class="sourceLine" id="cb33-2" title="2">$ git lg</a>
<a class="sourceLine" id="cb33-3" title="3">$ git logfull</a></code></pre></div>
<h3 id="know-who-did-what-and-when">know who did what and when</h3>
<div class="sourceCode" id="cb34"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb34-1" title="1">$ git blame fichier</a></code></pre></div>
<h3 id="handle-conflicts">handle conflicts</h3>
<div class="sourceCode" id="cb35"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb35-1" title="1">$ git conflict</a></code></pre></div>
<h3 id="manage-branches">manage branches</h3>
<p>To create a branch:</p>
<div class="sourceCode" id="cb36"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb36-1" title="1">$ git branch branch_name</a></code></pre></div>
<p>To change the current branch:</p>
<div class="sourceCode" id="cb37"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb37-1" title="1">$ git checkout branch_name</a></code></pre></div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-11-12
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - iphone call filter</title>
<meta name="keywords" content="iPhone, Apple, filter, blacklist" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-12-06-iphone-call-filter/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>iphone call filter</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>It is unbelievable you cannot filter your call with an iPhone! The only reason I see for that is a negotiation with phone operator to force users to get phone advertising. It is simple unacceptable.</p>
<p>Im a λ iPhones user. The only way to filter your call and to manage blacklist is to <em>jailbreak</em> your iPhone. And I dont want to do that. Then, if like me you find it unacceptable, just write a line to Apple: <a href="http://www.apple.com/feedback/iphone.html">http://www.apple.com/feedback/iphone.html</a></p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-12-06-iphone-call-filter/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-12-06-iphone-call-filter/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-12-06
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,2 @@
[alias]
uncommit = !zsh -c '"if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i<=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \"revert to $0 version(s) back\""'

View file

@ -0,0 +1,151 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Git vs. Bzr</title>
<meta name="keywords" content="git, bzr, DCVS, Bazaar" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2009-12-14-Git-vs--Bzr/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Git vs. Bzr</h1>
<h2>Why I switched from bazaar to git</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div class="intro">
<p>Why even if I believe <code>git</code> has many bad point I believe it is the best DCVS around to work with. This is why I first tell why I prefer <a href="http://bazaar-vcs.org">Bazaar</a> over <a href="http://git-scm.org">Git</a>. Secondly Ill talk about the only advantage of git against Bazaar which lead me to prefer it.</p>
</div>
<h2 id="the-dcvs-discovery">The DCVS discovery</h2>
<p>Before beginning this article, you should know I come from <em>subversion</em>. I find subversion to be a really good CVS. But I was converted to the decentralized ones.</p>
<p>There is two way of perceive version control system. Either you think in term of branches (see the really good article on <a href="http://betterexplained.com/articles/a-visual-guide-to-version-control/">betterexplained</a>) or think in term of patches. Another way to say that, is weather you concentrate on vertices or on transitions of the graph of possible states of your project.</p>
<p>This is the second approach who was behind <code>git</code> and this is the first behind Bazaar. <code>git</code> was created by Linus Torvald in order to close some gap in the version system used to develop the Linux kernel. And patches is a term which is more present than state in the development community.</p>
<p>I first was convinced by Bazaar. Why? Argument in favor of Bazaar were: user friendly, terminology close to the subversion one. And I tried a bit the two, and it was clearly more natural for me to use Bazaar. But after seeing so many people using <code>git</code> I decided to give it a serious try.</p>
<p>And it was so fastidious! The <code>git</code> terminology was <em>horrible</em>! And it is nothing to say it.</p>
<h2 id="where-bazaar-is-better-than-git">Where Bazaar is better than <code>git</code></h2>
<p>The first example, <code>checkout</code> is used to make only one thing from the technical point of vue. But from the user perspective, you make many <em>different</em> things with this word. Example:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1">git checkout pipo</a></code></pre></div>
<p>undo the current modification of the file <code>pipo</code></p>
<div class="sourceCode" id="cb2"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb2-1" title="1">git checkout pipo</a></code></pre></div>
<p>change the current branch to the branch <code>pipo</code></p>
<p>And, like me, you remark, it is exactly the same command to make two completely different things. What occur when you have a <code>pipo</code> branch and a <code>pipo</code> file? By default, it change the current branch. In order to leave the ambiguity you have to use the following syntax:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb3-1" title="1">git checkout ./pipo</a></code></pre></div>
<p>Yes, hum…</p>
<p>It works, but it is clearly not really user friendly. Furthermore, checkout had a complete different signification in older CSV like <code>cvs</code> et <code>svn</code>. <code>checkout</code> was used to get a distant project locally.</p>
<p>Bazaar terminology is far more natural, because there is no command to change the current branch as there is only one branch per directory. Changing a branch in Bazaar is changing the current directory. I also believe it is the biggest problem of Bazaar, Ill tell you why. And to undo things in Bazaar:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb4-1" title="1">bzr revert pipo</a></code></pre></div>
<p>Furthermore, most Bazaar command take a revision number in parameter. For example, to get back 3 versions earlier, it is enough to write:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb5-1" title="1">bzr revert -r -3 pipo</a></code></pre></div>
<p>The <code>git</code> equivalent is far more cryptic:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb6-1" title="1">bzr checkout HEAD~3 pipo</a></code></pre></div>
<p>One more time, Bazaar is far more readable.</p>
<p>Back in time for all the project:</p>
<p>with Bazaar:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb7-1" title="1">bzr revert -r -3 pipo</a></code></pre></div>
<p>and with <code>git</code>? <code>git checkout</code>? Of course not! It would be too simple. What we find in the documentation (<code>man</code>) and everywhere on the net:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb8-1" title="1">git reset --hard HEAD~3</a></code></pre></div>
<p>Except that this command is horrible. It forget revisions! Then you must use it with prudence. And you cannot tell other people working on the project you discard some changes. If someone had pulled the <em>bad</em> version, you are <em>doomed</em>. This is why you can also use:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb9-1" title="1">git checkout HEAD~3 -- <span class="kw">.</span> <span class="kw">&amp;&amp;</span> git commit -m <span class="st">'back in time'</span></a></code></pre></div>
<p>Just to keep a backup branch. Without it we can definitively loose the current version HEAD. But some error may rest when there were some addition and deletion of files. <em>The unique way to be really clean without any risk is to use the following command:</em></p>
<div class="sourceCode" id="cb10"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb10-1" title="1"><span class="kw">for</span> i <span class="kw">in</span> <span class="ot">$(</span><span class="kw">seq</span> 0 2<span class="ot">)</span>; <span class="kw">do</span></a>
<a class="sourceLine" id="cb10-2" title="2"> git revert -n --no-edit <span class="kw">head</span>~<span class="ot">$i</span>;</a>
<a class="sourceLine" id="cb10-3" title="3"><span class="kw">done</span></a>
<a class="sourceLine" id="cb10-4" title="4">git commit -m <span class="st">&quot;reverted 3 versions back&quot;</span></a></code></pre></div>
<p>And with this command this is the only good way to undo things in a project and tell other contributor you reverted something. You simply revert version in backward order.</p>
<p>The rule is simple: <em>NEVER use the <code>git reset</code> command on a version somebody else could have <code>fetched</code></em></p>
<p>It was said. Discover the best method took me some time. Id made many different tries. The safer and best way of reverting back your tree is to use this method. If you want to make it automatic just had the following alias in your <code>~/.gitconfig</code>. Of course this alias will work only on environment having <code>zsh</code> installed. Which is the cas for most UNIX (Ubuntu, Mac OS X…).</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb11-1" title="1">[alias]</a>
<a class="sourceLine" id="cb11-2" title="2"> uncommit = !<span class="kw">zsh</span> -c <span class="st">'&quot;if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i&lt;=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \&quot;revert to $0 version(s) back\&quot;&quot;'</span></a></code></pre></div>
<h1 id="what-make-git-by-far-the-best-dcvs-today">What make <code>git</code> by far the best DCVS today</h1>
<p>After talking about the negatives points of <code>git</code>, now its time to speak about the very positive feature that make <code>git</code> the best DCVS in my humble opinion.</p>
<h2 id="cheap-branching">Cheap branching</h2>
<p>You always work into the same main directory. For example, you can work on two fix in the same time. Say <code>fix1</code> require you to work on <code>file1</code> and <code>fix2</code> to work on <code>file2</code>. You can work in any order on <code>file1</code> and <code>file2</code> in the <code>master</code> branch. And then go to branch <code>fix1</code>, commit <code>file1</code> into it. Then go to branch <code>fix2</code> and commit <code>file2</code> into it. And finally merge the two branches <code>fix1</code> and <code>fix2</code> into <code>master</code>.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb12-1" title="1"><span class="kw">&gt;</span> vim file1</a>
<a class="sourceLine" id="cb12-2" title="2"><span class="kw">&gt;</span> vim file2</a>
<a class="sourceLine" id="cb12-3" title="3"><span class="kw">&gt;</span> git br fix1</a>
<a class="sourceLine" id="cb12-4" title="4"><span class="kw">&gt;</span> git add file1</a>
<a class="sourceLine" id="cb12-5" title="5"><span class="kw">&gt;</span> git commit -m <span class="st">'fix1'</span></a>
<a class="sourceLine" id="cb12-6" title="6"><span class="kw">&gt;</span> git br fix2</a>
<a class="sourceLine" id="cb12-7" title="7"><span class="kw">&gt;</span> git add file2</a>
<a class="sourceLine" id="cb12-8" title="8"><span class="kw">&gt;</span> git commit -m <span class="st">'fix2'</span></a>
<a class="sourceLine" id="cb12-9" title="9"><span class="kw">&gt;</span> git commit master</a>
<a class="sourceLine" id="cb12-10" title="10"><span class="kw">&gt;</span> git merge fix1</a>
<a class="sourceLine" id="cb12-11" title="11"><span class="kw">&gt;</span> git merge fix2</a></code></pre></div>
<p>And this is great not to worry about working in the <em>good</em> branch and coding in the same time. You just worry about your code and then about the versionning system.</p>
<p>And I use this possibilities <em>a lot</em>. Working with bazaar, I often made the error to begin a change in the bad branch. then I have to copy my modifications, then revert. In short it was tiedous.</p>
<p>This is why I prefer using <code>git</code> on an every day usage. If Bazaar implement the same way of cheap branching than git. I should switch again.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-12-14-Git-vs--Bzr/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2009-12-14-Git-vs--Bzr/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2009-12-14
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Change default shell on Mac OS X</title>
<meta name="keywords" content="Apple, Mac, OS X" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Change default shell on Mac OS X</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I just found a way to change the default shell on Mac OS X. This note is mostly for me, but somebody else should find it useful. Just launch the following command:</p>
<div>
<code class="zsh"> &gt; chsh </code>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-01-04
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Miscellaneous settings -->
<include ignore_missing="yes">misc.conf</include>
<!-- Define alias -->
<include ignore_missing="yes">alias.conf</include>
<!-- Rules for Microsoft fonts -->
<include ignore_missing="yes">msfonts-rules.conf</include>
<match target="pattern" name="family" >
<test name="family" qual="any" >
<string>Tahoma</string>
</test>
<edit mode="assign" name="family" >
<string>Verdana</string>
</edit>
</match>
<selectfont>
<acceptfont>
<pattern>
<patelt name="family">
<string>Lucida Grande</string>
</patelt>
</pattern>
</acceptfont>
</selectfont>
<match target="pattern" name="family" >
<test name="family" qual="any" >
<string>Georgia</string>
</test>
<edit mode="assign" name="family" >
<string>Georgia</string>
</edit>
</match>
<selectfont>
<acceptfont>
<pattern>
<patelt name="family">
<string>Century Schoolbook L</string>
</patelt>
</pattern>
</acceptfont>
</selectfont>
</fontconfig>

View file

@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - antialias font in Firefox under Ubuntu</title>
<meta name="keywords" content="Linux, Ubuntu, Fonts" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>antialias font in Firefox under Ubuntu</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>How to stop using bad Microsoft© font under Ubuntu Linux in order to user nice anti aliased font under Firefox.</p>
<p>Just modify the <code>/etc/fonts/local.conf</code> with the following code:</p>
<div>
<div class="sourceCode" id="cb1"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb1-1" title="1"></a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot;<span class="kw">?&gt;</span></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="dt">&lt;!DOCTYPE </span>fontconfig SYSTEM &quot;fonts.dtd&quot;<span class="dt">&gt;</span></a>
<a class="sourceLine" id="cb1-4" title="4"><span class="kw">&lt;fontconfig&gt;</span></a>
<a class="sourceLine" id="cb1-5" title="5"></a>
<a class="sourceLine" id="cb1-6" title="6"><span class="co">&lt;!-- Miscellaneous settings --&gt;</span></a>
<a class="sourceLine" id="cb1-7" title="7"></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="kw">&lt;include</span><span class="ot"> ignore_missing=</span><span class="st">&quot;yes&quot;</span><span class="kw">&gt;</span>misc.conf<span class="kw">&lt;/include&gt;</span></a>
<a class="sourceLine" id="cb1-9" title="9"></a>
<a class="sourceLine" id="cb1-10" title="10"><span class="co">&lt;!-- Define alias --&gt;</span></a>
<a class="sourceLine" id="cb1-11" title="11"></a>
<a class="sourceLine" id="cb1-12" title="12"><span class="kw">&lt;include</span><span class="ot"> ignore_missing=</span><span class="st">&quot;yes&quot;</span><span class="kw">&gt;</span>alias.conf<span class="kw">&lt;/include&gt;</span></a>
<a class="sourceLine" id="cb1-13" title="13"></a>
<a class="sourceLine" id="cb1-14" title="14"><span class="co">&lt;!-- Rules for Microsoft fonts --&gt;</span></a>
<a class="sourceLine" id="cb1-15" title="15"></a>
<a class="sourceLine" id="cb1-16" title="16"><span class="kw">&lt;include</span><span class="ot"> ignore_missing=</span><span class="st">&quot;yes&quot;</span><span class="kw">&gt;</span>msfonts-rules.conf<span class="kw">&lt;/include&gt;</span></a>
<a class="sourceLine" id="cb1-17" title="17"></a>
<a class="sourceLine" id="cb1-18" title="18"> <span class="kw">&lt;match</span><span class="ot"> target=</span><span class="st">&quot;pattern&quot;</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-19" title="19"> <span class="kw">&lt;test</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span><span class="ot"> qual=</span><span class="st">&quot;any&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-20" title="20"> <span class="kw">&lt;string&gt;</span>Tahoma<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb1-21" title="21"> <span class="kw">&lt;/test&gt;</span></a>
<a class="sourceLine" id="cb1-22" title="22"> <span class="kw">&lt;edit</span><span class="ot"> mode=</span><span class="st">&quot;assign&quot;</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-23" title="23"> <span class="kw">&lt;string&gt;</span>Verdana<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb1-24" title="24"> <span class="kw">&lt;/edit&gt;</span></a>
<a class="sourceLine" id="cb1-25" title="25"> <span class="kw">&lt;/match&gt;</span></a>
<a class="sourceLine" id="cb1-26" title="26"> <span class="kw">&lt;selectfont&gt;</span></a>
<a class="sourceLine" id="cb1-27" title="27"> <span class="kw">&lt;acceptfont&gt;</span></a>
<a class="sourceLine" id="cb1-28" title="28"> <span class="kw">&lt;pattern&gt;</span></a>
<a class="sourceLine" id="cb1-29" title="29"> <span class="kw">&lt;patelt</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span><span class="kw">&gt;</span> </a>
<a class="sourceLine" id="cb1-30" title="30"> <span class="kw">&lt;string&gt;</span>Lucida Grande<span class="kw">&lt;/string&gt;</span> </a>
<a class="sourceLine" id="cb1-31" title="31"> <span class="kw">&lt;/patelt&gt;</span></a>
<a class="sourceLine" id="cb1-32" title="32"> <span class="kw">&lt;/pattern&gt;</span></a>
<a class="sourceLine" id="cb1-33" title="33"> <span class="kw">&lt;/acceptfont&gt;</span></a>
<a class="sourceLine" id="cb1-34" title="34"> <span class="kw">&lt;/selectfont&gt;</span></a>
<a class="sourceLine" id="cb1-35" title="35"></a>
<a class="sourceLine" id="cb1-36" title="36"> <span class="kw">&lt;match</span><span class="ot"> target=</span><span class="st">&quot;pattern&quot;</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-37" title="37"> <span class="kw">&lt;test</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span><span class="ot"> qual=</span><span class="st">&quot;any&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-38" title="38"> <span class="kw">&lt;string&gt;</span>Georgia<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb1-39" title="39"> <span class="kw">&lt;/test&gt;</span></a>
<a class="sourceLine" id="cb1-40" title="40"> <span class="kw">&lt;edit</span><span class="ot"> mode=</span><span class="st">&quot;assign&quot;</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span> <span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-41" title="41"> <span class="kw">&lt;string&gt;</span>Georgia<span class="kw">&lt;/string&gt;</span></a>
<a class="sourceLine" id="cb1-42" title="42"> <span class="kw">&lt;/edit&gt;</span></a>
<a class="sourceLine" id="cb1-43" title="43"> <span class="kw">&lt;/match&gt;</span></a>
<a class="sourceLine" id="cb1-44" title="44"> <span class="kw">&lt;selectfont&gt;</span></a>
<a class="sourceLine" id="cb1-45" title="45"> <span class="kw">&lt;acceptfont&gt;</span></a>
<a class="sourceLine" id="cb1-46" title="46"> <span class="kw">&lt;pattern&gt;</span></a>
<a class="sourceLine" id="cb1-47" title="47"> <span class="kw">&lt;patelt</span><span class="ot"> name=</span><span class="st">&quot;family&quot;</span><span class="kw">&gt;</span> </a>
<a class="sourceLine" id="cb1-48" title="48"> <span class="kw">&lt;string&gt;</span>Century Schoolbook L<span class="kw">&lt;/string&gt;</span> </a>
<a class="sourceLine" id="cb1-49" title="49"> <span class="kw">&lt;/patelt&gt;</span></a>
<a class="sourceLine" id="cb1-50" title="50"> <span class="kw">&lt;/pattern&gt;</span></a>
<a class="sourceLine" id="cb1-51" title="51"> <span class="kw">&lt;/acceptfont&gt;</span></a>
<a class="sourceLine" id="cb1-52" title="52"> <span class="kw">&lt;/selectfont&gt;</span></a>
<a class="sourceLine" id="cb1-53" title="53"></a>
<a class="sourceLine" id="cb1-54" title="54"><span class="kw">&lt;/fontconfig&gt;</span></a></code></pre></div>
</div>
<p>Hope it helped someone who like me had his eyes crying in face of such ugly fonts.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-01-12
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Pragmatic Regular Expression Exclude</title>
<meta name="keywords" content="regex, regexp, regular expression, negate" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-02-15-All-but-something-regexp/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Pragmatic Regular Expression Exclude</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Sometimes you cannot simply write:</p>
<div>
<code class="ruby"> if str.match(regexp) and not str.match(other_regexp) do_something </code>
</div>
<p>and you have to make this behaviour with only one regular expression. But, there exists a major problem: the complementary of a regular language might not be regular. Then, for some expression it is absolutely impossible to negate a regular expression.</p>
<p>But sometimes with some simple regular expression it should be possible<sup><a href="#note1"></a></sup>. Say you want to match everything containing the some word say <code>bull</code> but dont want to match <code>bullshit</code>. Here is a nice way to do that:</p>
<div>
<p><code class="ruby"> # match all string containing bull (bullshit comprised) /bull/</p>
<h1 id="match-all-string-containing-bull-except-bullshit">match all string containing bull except bullshit</h1>
<p>/bull([^s]|<span class="math inline">)|<em>b</em><em>u</em><em>l</em><em>l</em><em>s</em>([<sup><em>h</em></sup>]|</span>)| bullsh([^i]|<span class="math inline">)|<em>b</em><em>u</em><em>l</em><em>l</em><em>s</em><em>h</em><em>i</em>([<sup><em>t</em></sup>]|</span>)/</p>
<h1 id="another-way-to-write-it-would-be">another way to write it would be</h1>
/bull([^s]|<span class="math inline">|<em>s</em>([<sup><em>h</em></sup>]|</span>)|sh([^i]|<span class="math inline">)|<em>s</em><em>h</em><em>i</em>([<sup><em>t</em></sup>]|</span>))/ </code>
</div>
<p>Let look closer. In the first line the expression is: <code>bull([^s]|$)</code>, why does the <code>$</code> is needed? Because, without it the word <code>bull</code> would be no more matched. This expression means:</p>
<blockquote>
<p>The string finish by <code>bull</code><br />
or,<br />
contains <code>bull</code> followed by a letter different from <code>s</code>.</p>
</blockquote>
<p>And this is it. I hope it could help you.</p>
Notice this method is not always the best. For example try to write a regular expression equivalent to the following conditional expression:
<div>
<code class="ruby"> # Begin with a: ^a # End with a: c$ # Contain b: .<em>b.</em> # But isnt axbxc if str.match(/^a.<em>b.</em>c<span class="math inline">/)<em>a</em><em>n</em><em>d</em><em>n</em><em>o</em><em>t</em><em>s</em><em>t</em><em>r</em>.<em>m</em><em>a</em><em>t</em><em>c</em><em>h</em>(/<sup><em>a</em></sup><em>x</em><em>b</em><em>x</em><em>c</em></span>/) do_something end </code>
</div>
<p>A nice solution is:</p>
<div>
<code class="ruby"> /abc| # length 3 a.bc| # length 4 ab.c| a[^x]b[^x]c| # length 5 a…<em>b.</em>c| # length &gt;5 a.<em>b…</em>c/ </code>
</div>
<p>This solution uses the maximal length of the string not to be matched. There certainly exists many other methods. But the important lesson is it is not straightforward to exclude something of a regular expression.</p>
<hr />
<p><small><a name="note1"></a> It can be proved that any regular set minus a finite set is also regular. </small></p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-15-All-but-something-regexp/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-15-All-but-something-regexp/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-02-15
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Pragmatic Regular Expression Exclude (2)</title>
<meta name="keywords" content="regexp, regular expression" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-02-16-All-but-something-regexp--2-/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Pragmatic Regular Expression Exclude (2)</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>In my <a href="../../../../Scratch/en/blog/2010-02-15-All-but-something-regexp">previous post</a> I had given some trick to match all except something. On the same idea, the trick to match the smallest possible string. Say you want to match the string between a and b, for example, you want to match:</p>
<pre>
a.....<strong class="blue">a......b</strong>..b..a....<strong class="blue">a....b</strong>...
</pre>
<p>Here are two common errors and a solution:</p>
<pre>
/a.*b/
<strong class="red">a.....a......b..b..a....a....b</strong>...
</pre>
<p>The first error is to use the <em>evil</em> <code>.*</code>. Because you will match from the first to the last.</p>
<pre>
/a.*?b/
<strong class="red">a.....a......b</strong>..b..<strong class="red">a....a....b</strong>...
</pre>
<p>The next natural way, is to change the <em>greediness</em>. But it is not enough as you will match from the first <code>a</code> to the first <code>b</code>. Then a simple constatation is that our matching string shouldnt contain any <code>a</code> nor <code>b</code>. Which lead to the last elegant solution.</p>
<pre>
/a[^ab]*b/
a.....<strong class="blue">a......b</strong>..b..a....<strong class="blue">a....b</strong>...
</pre>
<p>Until now, that was, easy. Now, just pass at the case you need to match not between <code>a</code> and <code>b</code>, but between strings. For example:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">&lt;li&gt;</span>...<span class="kw">&lt;li&gt;</span></a></code></pre></div>
<p>This is a bit difficult. You need to match</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">&lt;li&gt;</span>[anything not containing <span class="kw">&lt;li&gt;</span>]<span class="kw">&lt;/li&gt;</span></a></code></pre></div>
<p>The first method would be to use the same reasoning as in my <a href="../../../../Scratch/en/blog/2010-02-15-All-but-something-regexp">previous post</a>. Here is a first try:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb3-1" title="1">&lt;li&gt;([^&lt;]|&lt;[^l]|&lt;l[^i]|&lt;li[^&gt;])<span class="dt">*&lt;</span><span class="kw">/</span><span class="ot">li&gt;</span></a></code></pre></div>
<p>But what about the following string:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb4-1" title="1"><span class="kw">&lt;li&gt;</span>...<span class="kw">&lt;li</span><span class="er">&lt;/li</span><span class="kw">&gt;</span></a></code></pre></div>
<p>That string should not match. This is why if we really want to match it correctly<sup><a href="#note1"></a></sup> we need to add:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb5-1" title="1">&lt;li&gt;([^&lt;]|&lt;[^l]|&lt;l[^i]|&lt;li[^&gt;])*(|&lt;|&lt;l|&lt;li)&lt;/li&gt;</a></code></pre></div>
<p>Yes a bit complicated. But what if the string I wanted to match was even longer?</p>
<p>Here is the algorithm way to handle this easily. You reduce the problem to the first one letter matching:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb6-1" title="1"><span class="co"># transform a simple randomly choosen character</span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="co"># to an unique ID</span></a>
<a class="sourceLine" id="cb6-3" title="3"><span class="co"># (you should verify the identifier is REALLY unique)</span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="co"># beware the unique ID must not contain the</span></a>
<a class="sourceLine" id="cb6-5" title="5"><span class="co"># choosen character</span></a>
<a class="sourceLine" id="cb6-6" title="6"><span class="kw">s/</span><span class="ot">X</span><span class="kw">/</span><span class="st">_was_x_</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-7" title="7"><span class="kw">s/</span><span class="ot">Y</span><span class="kw">/</span><span class="st">_was_y_</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-8" title="8"></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co"># transform the long string in this simple character</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="kw">s/</span><span class="ot">&lt;li&gt;</span><span class="kw">/</span><span class="st">X</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-11" title="11"><span class="kw">s/</span><span class="ot">&lt;\/li&gt;</span><span class="kw">/</span><span class="st">Y</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-12" title="12"></a>
<a class="sourceLine" id="cb6-13" title="13"><span class="co"># use the first method</span></a>
<a class="sourceLine" id="cb6-14" title="14"><span class="kw">s/</span><span class="ot">X</span><span class="ch">([^</span><span class="bn">X</span><span class="ch">]*)</span><span class="ot">Y</span><span class="kw">//g</span></a>
<a class="sourceLine" id="cb6-15" title="15"></a>
<a class="sourceLine" id="cb6-16" title="16"><span class="co"># retransform choosen letter by string</span></a>
<a class="sourceLine" id="cb6-17" title="17"><span class="kw">s/</span><span class="ot">X</span><span class="kw">/</span><span class="st">&lt;li&gt;</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-18" title="18"><span class="kw">s/</span><span class="ot">Y</span><span class="kw">/</span><span class="st">&lt;\/li&gt;</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-19" title="19"></a>
<a class="sourceLine" id="cb6-20" title="20"><span class="co"># retransform the choosen character back</span></a>
<a class="sourceLine" id="cb6-21" title="21"><span class="kw">s/</span><span class="ot">_was_x_</span><span class="kw">/</span><span class="st">X</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb6-22" title="22"><span class="kw">s/</span><span class="ot">_was_y_</span><span class="kw">/</span><span class="st">Y</span><span class="kw">/g</span></a></code></pre></div>
<p>And it works in only 9 lines for any beginning and ending string. This solution should look less <em>I AM THE GREAT REGEXP M45T3R, URAN00B</em>, but is more convenient in my humble opinion. Further more, using this last solution prove you master regexp, because you know it is difficult to manage such problems with only a regexp.</p>
<hr />
<p><small><a name="note1"><sup></sup></a> I know I used an HTML syntax example, but in my real life usage, I needed to match between <code>en:</code> and <code>::</code>. And sometimes the string could finish with <code>e::</code>.</small></p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-16-All-but-something-regexp--2-/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-16-All-but-something-regexp--2-/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-02-16
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - split a file by keyword</title>
<meta name="keywords" content="awk, shell, script" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-02-18-split-a-file-by-keyword/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>split a file by keyword</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Strangely enough, I didnt find any built-in tool to split a file by keyword. I made one myself in <code>awk</code>. I put it here mostly for myself. But it could also helps someone else. The following code split a file for each line containing the word <code>UTC</code>.</p>
<div>
<code class="perl"> #!/usr/bin/env awk BEGIN{i=0;} /UTC/ { i+=1; FIC=sprintf(“fic.%03d”,i); } {print $0&gt;&gt;FIC} </code>
</div>
<p>In my real world example, I wanted one file per day, each line containing UTC being in the following format:</p>
<pre class="twilight">
Mon Dec 7 10:32:30 UTC 2009
</pre>
<p>I then finished with the following code:</p>
<div>
<code class="perl"> #!/usr/bin/env awk BEGIN{i=0;} /UTC/ { date=$1$2$3; if ( date != olddate ) { olddate=date; i+=1; FIC=sprintf(“fic.%03d”,i); } } {print $0&gt;&gt;FIC} </code>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-02-18
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
#!/usr/bin/env ruby
require 'benchmark'
n=80000
tab=[ '/accounts/user.json',
'/accounts/user.xml',
'/user/titi/blog/toto.json',
'/user/titi/blog/toto.xml' ]
puts "Get extname"
Benchmark.bm do |x|
x.report("regexp:") { n.times do
str=tab[rand(4)];
str.match(/[^.]*$/);
ext=$&;
end }
x.report(" split:") { n.times do
str=tab[rand(4)];
ext=str.split('.')[-1] ;
end }
x.report(" File:") { n.times do
str=tab[rand(4)];
ext=File.extname(str);
end }
end

View file

@ -0,0 +1,20 @@
#!/usr/bin/env ruby
require 'benchmark'
n=80000
tab=[ '/accounts/user.json',
'/accounts/user.xml',
'/user/titi/blog/toto.json',
'/user/titi/blog/toto.xml' ]
puts "remove extension"
Benchmark.bm do |x|
x.report(" File:") { n.times do
str=tab[rand(4)];
path=File.expand_path(str,File.basename(str,File.extname(str)));
end }
x.report("chomp:") { n.times do
str=tab[rand(4)];
ext=File.extname(str);
path=str.chomp(ext);
end }
end

View file

@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - When regexp is not the best solution</title>
<meta name="keywords" content="programming, regexp, regular expression, extension, file" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-02-23-When-regexp-is-not-the-best-solution/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>When regexp is not the best solution</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Regular expression are really useful. Unfortunately, they are not always the best way of doing things. Particularly when transformations you want to make are easy.</p>
<p>I wanted to know how to get file extension from filename the fastest way possible. There is 3 natural way of doing this:</p>
<div>
<p><code class="ruby"> # regexp str.match(/[^.]*<span class="math inline">/);<em>e</em><em>x</em><em>t</em>=</span>&amp;</p>
<h1 id="split">split</h1>
<p>ext=str.split(.)[-1]</p>
<h1 id="file-module">File module</h1>
ext=File.extname(str) </code>
</div>
<p>At first sight I believed that the regexp should be faster than the split because it could be many <code>.</code> in a filename. But in reality, most of time there is only one dot and I realized the split will be faster. But not the fastest way. There is a function dedicated to this work in the <code>File</code> module.</p>
<p>Here is the Benchmark ruby code:</p>
<div>
<p><code class="ruby" file="regex_benchmark_ext.rb"> #!/usr/bin/env ruby require benchmark n=80000 tab=[ /accounts/user.json, /accounts/user.xml, /user/titi/blog/toto.json, /user/titi/blog/toto.xml ]</p>
puts “Get extname” Benchmark.bm do |x| x.report(“regexp:”) { n.times do str=tab[rand(4)]; str.match(/[^.]*<span class="math inline">/);<em>e</em><em>x</em><em>t</em>=</span>&amp;; end } x.report(" split:“) { n.times do str=tab[rand(4)]; ext=str.split(.)[-1] ; end } x.report(” File:") { n.times do str=tab[rand(4)]; ext=File.extname(str); end } end </code>
</div>
<p>And here is the result</p>
<pre class="twilight">
Get extname
user system total real
regexp: 2.550000 0.020000 2.570000 ( 2.693407)
split: 1.080000 0.050000 1.130000 ( 1.190408)
File: 0.640000 0.030000 0.670000 ( 0.717748)
</pre>
<p>Conclusion of this benchmark, dedicated function are better than your way of doing stuff (most of time).</p>
<h2 id="file-path-without-the-extension.">file path without the extension.</h2>
<div>
<p><code class="ruby" file="regex_benchmark_strip.rb"> #!/usr/bin/env ruby require benchmark n=80000 tab=[ /accounts/user.json, /accounts/user.xml, /user/titi/blog/toto.json, /user/titi/blog/toto.xml ]</p>
puts “remove extension” Benchmark.bm do |x| x.report(" File:“) { n.times do str=tab[rand(4)]; path=File.expand_path(str,File.basename(str,File.extname(str))); end } x.report(”chomp:") { n.times do str=tab[rand(4)]; ext=File.extname(str); path=str.chomp(ext); end } end </code>
</div>
<p>and here is the result:</p>
<pre class="twilight">
remove extension
user system total real
File: 0.970000 0.060000 1.030000 ( 1.081398)
chomp: 0.820000 0.040000 0.860000 ( 0.947432)
</pre>
<p>Conclusion of the second benchmark. One simple function is better than three dedicated functions. No surprise, but it is good to know.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-02-23
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Git Tips</title>
<meta name="keywords" content="git, tip" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-03-22-Git-Tips/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Git Tips</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<h2 id="clone-from-github-behind-an-evil-firewall">clone from github behind an evil firewall</h2>
<p>Standard:</p>
<div>
<code class="zsh"> git clone git@github.com:yogsototh/project.git </code>
</div>
<p>Using HTTPS port:</p>
<div>
<code class="zsh"> git clone git+ssh://git@github.com:443/yogsototh/project.git </code>
</div>
<h2 id="clone-all-branches">clone all branches</h2>
<p><code>git clone</code> can only fetch the master branch.</p>
<p>If you dont have much branches, you can simply use clone your project and then use the following command:</p>
<div>
<code class="zsh"> git branch track local_branch remote_branch </code>
</div>
for example:
<div>
<code class="zsh"> $ git clone git@github:yogsototh/example.git $ git branch master <em> $ git branch -a master </em> remotes/origin/HEAD -&gt; origin/master remotes/origin/experimental $ git branch track experimental remotes/origin/experimental $ git branch master * experimental </code>
</div>
<p>If you have many branches it can be useful to use the following <em>script</em>/<em>long command line</em>.</p>
<div>
<p><code class="zsh"> # first clone your project $ git clone git@github.com:yogsototh/project.git</p>
<h1 id="copy-all-branches">copy all branches</h1>
$ zsh $ cd project $ for br in $( git br -a ); do case $br in remotes/<em>) print $br ; case ${br:t} in master|HEAD) continue ;; </em>) git branch track ${br:t} $br ;; esac ;; esac done </code>
</div>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-03-22-Git-Tips/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-03-22-Git-Tips/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-03-22
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,102 @@
#!/usr/bin/env ruby
# encoding: utf-8
# architecture
#
# master <-> dev
# master -> client
# clien -> clientA | clientB
#
# merge using two of these branches should be
# restricted to these rules
# merge to one of these branch and an unknown one should
# raise a warning, and may the option to add this new branch
# to the hierarchy
$architecture={
:master => [ :dev, :client ],
:dev => [ :master ],
:client => [ :clientA, :clientB ] }
def get_current_branch()
(`git branch --no-color | awk '$1 == "*" {print $2}'`).chop.intern
end
if ARGV.length == 0
puts %{usage: $0:t [git_command or local_command]
local commands:
allmerges: merge from top to down}
exit 0
end
require 'set'
$known_branches=Set.new
$architecture.each do |k,v|
$known_branches.add(k)
v.each { |b| $known_branches.add(b) }
end
def rec_merge(branch)
if $architecture[branch].nil?
return
end
$architecture[branch].each do |b|
if $flag.has_key?(b.to_s + branch.to_s)
next
end
flagname=branch.to_s + b.to_s
if $flag.has_key?(flagname)
next
end
if system %{eng checkout #{b}}
if get_current_branch != b
puts "Can't checkout to #{b}"
exit 2
end
if system %{eng merge #{branch}}
$flag[flagname]=true
rec_merge(b)
else
exit 1
end
else
exit 1
end
end
end
def do_all_merges
puts 'Will merge from father to sons'
current_branch=get_current_branch
$flag={}
rec_merge(:master)
system %{git co #{current_branch}}
end
def do_merge
current_branch=get_current_branch
src_branch=ARGV[1].intern
puts %{do_merge: #{src_branch} => #{current_branch}}
if $known_branches.include?(current_branch)
if $known_branches.include?(src_branch)
if $architecture.has_key?(src_branch) and
$architecture[src_branch].include?(current_branch)
system %{git merge #{src_branch}}
else
puts %{Forbidden merge: #{src_branch} => #{current_branch}}
end
else
puts %{Warning! #{src_branch} not mentionned in rb configuration}
sleep 2
system %{git merge #{src_branch}}
puts %{Warning! #{src_branch} not mentionned in rb configuration}
end
end
end
case ARGV[0]
when 'allmerges' then do_all_merges
when 'merge' then do_merge
else system %{git #{ARGV.join(' ')}}
end

View file

@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Encapsulate git</title>
<meta name="keywords" content="git, protection, branches, diverged" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-03-23-Encapsulate-git/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Encapsulate git</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div class="intro">
<p>Here is a solution to maintain divergent branches in git. Because it is easy to merge by mistake. I give a script that encapsulate git in order to forbid some merge and warn you some merge should be dangerous.</p>
</div>
<h2 id="how-to-protect-against-your-own-dumb">how to protect against your own dumb</h2>
<p>I work on a project in which some of my git branches should remain divergent. And divergences should grow.</p>
<p>I also use some branch to contain what is common between projects.</p>
<p>Say I have some branches:</p>
<p>master: common to all branches dev: branch devoted to unstable development client: branch with features for all client but not general enough for master clientA: project adapted for client A clientB: project adapted for client B</p>
<p>Here how I want to work:</p>
<div>
<img src="../../../../Scratch/img/blog/2010-03-23-Encapsulate-git/dynamic_branching.png" alt="Dynamic branching" />
</div>
<p>And more precisely the branch hierarchy:</p>
<div>
<img src="../../../../Scratch/img/blog/2010-03-23-Encapsulate-git/branch_hierarchy.png" alt="Branch hierarchy" />
</div>
<p>An arrow from A to B means, you can merge A in B. If there is no arrow from A to B that means it is <em>forbidden</em> to merge A in B. Here is the corresponding rubycode:</p>
<div>
<code class="ruby"> $architecture={ :master =&gt; [ :dev, :client ], :dev =&gt; [ :master ], :client =&gt; [ :clientA, :clientB ] } </code>
</div>
<p>Having a <code>:master =&gt; [ :dev, :client ]</code> means you can merge <code>master</code> branch into <code>dev</code> and <code>client</code>.</p>
<p>If by mistake I make a <code>git checkout master &amp;&amp; git merge clientA</code>, I made a mistake. This is why I made a script which encapsulate the git behaviour to dodge this kind of mistake.</p>
<p>But this script do far more than that. It also merge from top to down. The action <code>allmerges</code> will do:</p>
<div>
<code class="zsh"> git co dev &amp;&amp; git merge master git co client &amp;&amp; git merge master git co clientA &amp;&amp; git merge client git co clientB &amp;&amp; git merge client </code>
</div>
<p>That means, I can update all branches. The algorithm will not make loop even if there is a cycle in the branch hierarchy.</p>
<p>Here it is:</p>
<div class="small">
<p><code class="ruby" file="eng"> #!/usr/bin/env ruby # encoding: utf-8</p>
<h1 id="architecture">architecture</h1>
<h1 id="section"></h1>
<h1 id="master---dev">master &lt;-&gt; dev</h1>
<h1 id="master---client">master -&gt; client</h1>
<h1 id="clien---clienta-clientb">clien -&gt; clientA | clientB</h1>
<h1 id="section-1"></h1>
<h1 id="merge-using-two-of-these-branches-should-be">merge using two of these branches should be</h1>
<h1 id="restricted-to-these-rules">restricted to these rules</h1>
<h1 id="merge-to-one-of-these-branch-and-an-unknown-one-should">merge to one of these branch and an unknown one should</h1>
<h1 id="raise-a-warning-and-may-the-option-to-add-this-new-branch">raise a warning, and may the option to add this new branch</h1>
<h1 id="to-the-hierarchy">to the hierarchy</h1>
<p>$architecture={ :master =&gt; [ :dev, :client ], :dev =&gt; [ :master ], :client =&gt; [ :clientA, :clientB ] }</p>
<p>def get_current_branch() (<code>git branch --no-color | awk '$1 == "*" {print $2}'</code>).chop.intern end</p>
<p>if ARGV.length == 0 puts %{usage: $0:t [git_command or local_command]</p>
<p>local commands: allmerges: merge from top to down} exit 0 end</p>
<p>require set $known_branches=Set.new $architecture.each do |k,v| $known_branches.add(k) v.each { |b| $known_branches.add(b) } end</p>
<p>def rec_merge(branch) if $architecture[branch].nil? return end $architecture[branch].each do |b| if $flag.has_key?(b.to_s + branch.to_s) next end flagname=branch.to_s + b.to_s if $flag.has_key?(flagname) next end if system %{eng checkout #{b}} if get_current_branch != b puts “Cant checkout to #{b}” exit 2 end if system %{eng merge #{branch}} $flag[flagname]=true rec_merge(b) else exit 1 end else exit 1 end end end</p>
<p>def do_all_merges puts Will merge from father to sons current_branch=get_current_branch $flag={} rec_merge(:master) system %{git co #{current_branch}} end</p>
<p>def do_merge current_branch=get_current_branch src_branch=ARGV[1].intern puts %{do_merge: #{src_branch} =&gt; #{current_branch}} if $known_branches.include?(current_branch) if $known_branches.include?(src_branch) if $architecture.has_key?(src_branch) and $architecture[src_branch].include?(current_branch) system %{git merge #{src_branch}} else puts %{Forbidden merge: #{src_branch} =&gt; #{current_branch}} end else puts %{Warning! #{src_branch} not mentionned in rb configuration} sleep 2 system %{git merge #{src_branch}} puts %{Warning! #{src_branch} not mentionned in rb configuration} end end end</p>
case ARGV[0] when allmerges then do_all_merges when merge then do_merge else system %{git #{ARGV.join( )}} end </code>
</div>
<p>All you need to do to make it work is simply to copy eng in a directory contained in your PATH.</p>
<p>Of course try to use as few as possible <code>cherry-pick</code> and <code>rebase</code>. This script was intended to work with workflow using <code>pull</code> and <code>merge</code>.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-03-23-Encapsulate-git/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-03-23-Encapsulate-git/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-03-23
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - I live again!</title>
<meta name="keywords" content="blog" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-05-17-at-least-this-blog-revive/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>I live again!</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>Hi all!</p>
<blockquote>
<p>The more you wait to do something, the more difficult it is to start doing it. {: cite=“http://www.madore.org/~david/weblog/2010-05.html#d.2010-05-12.1752” }</p>
</blockquote>
<p>I had to write another post for this blog. I had added many article idea in my todolist. But, I made many other things, and Ive always said (until now), Ill do this later. What changed my mind is the haunt of this simple remark about how to be productive in programming. &gt; Stop write <code>TODO</code> in your code and make it now!<br />
&gt; Youll be surprised by the results.</p>
<p>In short: &gt; <strong>Just do it!</strong> ou <strong>Juste fait le</strong> comme auraient dit les nuls.</p>
<p>Finally Ill certainly write blog post more often for a short period of time.</p>
<h3 id="what-did-i-do">What did I do?</h3>
<p>I finished some web services/application for <a href="http://www.gridpocket.com">gridpocket(c)</a>.</p>
<p>I also finished to update my blog engine to nanoc3. The difficult part was to handle nicely multiple languages. But I should detail why in a future post.</p>
<p>I also have a <em>real</em> life. I enjoyed some vacancies with my family.</p>
<p>I work with <a href="http://www.lucarea.net">Luc</a> on a simple ruby REST/JSON/API oriented framework. It works fairly well, with really few bug until now. We planify to make a simple todolist tutorial. May be in two to three blog posts. This framework is not public for now. It will certainly be after well create some simple web service with it and made a nice website for it.</p>
<p>Then what I plan to do from now:</p>
<ul>
<li>finish to make a public web service (I believe it can be popular)</li>
<li>finish to write the associated iPhone application for it</li>
<li>finish to publish our private framework to make web services</li>
<li>publish some articles about this blog (at least 3)</li>
<li>provide the sources of this website on <a href="http://github.com">github</a></li>
</ul>
<p>There is some random in some of these achivement mostly because they dont depend totally on me.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-17-at-least-this-blog-revive/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-17-at-least-this-blog-revive/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-05-17
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
# repair cutted XML code by closing the tags
# work even if the XML is cut into a tag.
# example:
# transform '<div> <span> toto </span> <p> hello <a href="http://tur'
# into '<div> <span> toto </span> <p> hello </p></div>'
def repair_xml( xml )
parents=[]
depth=0
xml.scan( %r{<(/?)(\w*)[^>]*(/?)>} ).each do |m|
if m[2] == "/"
next
end
if m[0] == ""
parents[depth]=m[1]
depth+=1
else
depth-=1
end
end
res=xml.sub(/<[^>]*$/m,'')
depth-=1
depth.downto(0).each { |x| res<<= %{</#{parents[x]}>} }
res
end

View file

@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - How to repair a cutted XML?</title>
<meta name="keywords" content="tree, HTML, script, ruby" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-05-19-How-to-cut-HTML-and-repair-it/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>How to repair a cutted XML?</h1>
<h2>and how to do it without any parsor?</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>For my main page, you can see, a list of my latest blog entry. And you have the first part of each article. To accomplish that, I needed to include the begining of the entry and to cut it somewhere. But now, I had to repair this cutted HTML.</p>
<p>Here is an example:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;corps&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-2" title="2"> <span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;intro&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="kw">&lt;p&gt;</span>Introduction<span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="kw">&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb1-5" title="5"> <span class="kw">&lt;p&gt;</span>The first paragraph<span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="kw">&lt;img</span><span class="ot"> src=</span><span class="st">&quot;/img/img.png&quot;</span><span class="ot"> alt=</span><span class="st">&quot;an image&quot;</span><span class="kw">/&gt;</span></a>
<a class="sourceLine" id="cb1-7" title="7"> <span class="kw">&lt;p&gt;</span>Another long paragraph<span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="kw">&lt;/div&gt;</span></a></code></pre></div>
<p>After the cut, I obtain:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;corps&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;intro&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="kw">&lt;p&gt;</span>Introduction<span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="kw">&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">&lt;p&gt;</span>The first paragraph<span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">&lt;img</span><span class="ot"> src=</span><span class="st">&quot;/img/im</span></a></code></pre></div>
<p>Argh! In the middle of an <code>&lt;img&gt;</code> tag.</p>
<p>In fact, it is not as difficult as it should sound first. The secret is, you dont need to keep the complete tree structure to repair it, but only the list of not closed parents.</p>
<p>Given with our example, when we are after the first paragraph. we only have to close the <code>div</code> for class <code>corps</code> and the XML is repaired. Of course, when you cut inside a tag, you sould go back, as if you where just before it. Delete this tag and all is ok.</p>
<p>Then, all you have to do, is not remember all the XML tree, but only the heap containing your parents. Suppose we treat the complete first example, the stack will pass through the following state, in order:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb3-1" title="1">[] </a>
<a class="sourceLine" id="cb3-2" title="2">[div] <span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;corps&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb3-3" title="3">[div, div] <span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;intro&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb3-4" title="4">[div, div, p] <span class="kw">&lt;p&gt;</span></a>
<a class="sourceLine" id="cb3-5" title="5"> Introduction</a>
<a class="sourceLine" id="cb3-6" title="6">[div, div] <span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb3-7" title="7">[div] <span class="kw">&lt;/div&gt;</span></a>
<a class="sourceLine" id="cb3-8" title="8">[div, p] <span class="kw">&lt;p&gt;</span></a>
<a class="sourceLine" id="cb3-9" title="9"> The first paragraph</a>
<a class="sourceLine" id="cb3-10" title="10">[div] <span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb3-11" title="11">[div] <span class="kw">&lt;img</span><span class="ot"> src=</span><span class="st">&quot;/img/img.png&quot;</span><span class="ot"> alt=</span><span class="st">&quot;an image&quot;</span><span class="kw">/&gt;</span></a>
<a class="sourceLine" id="cb3-12" title="12">[div, p] <span class="kw">&lt;p&gt;</span></a>
<a class="sourceLine" id="cb3-13" title="13"> Another long paragraph</a>
<a class="sourceLine" id="cb3-14" title="14">[div] <span class="kw">&lt;/p&gt;</span></a>
<a class="sourceLine" id="cb3-15" title="15">[] <span class="kw">&lt;/div&gt;</span></a></code></pre></div>
<p>The algorihm, is then really simple: ~~~~~~ {.html} let res be the XML as a string ; read res and each time you encouter a tag: if it is an opening one: push it to the stack else if it is a closing one: pop the stack.</p>
<p>remove any malformed/cutted tag in the end of res for each tag in the stack, pop it, and write: res = res + closed tag</p>
<p>return res ~~~~~~</p>
<p>And <code>res</code> contain the repaired XML.</p>
<p>Finally, this is the code in ruby I use. The <code>xml</code> variable contain the cutted XML.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb4-1" title="1"><span class="co"># repair cutted XML code by closing the tags</span></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="co"># work even if the XML is cut into a tag.</span></a>
<a class="sourceLine" id="cb4-3" title="3"><span class="co"># example:</span></a>
<a class="sourceLine" id="cb4-4" title="4"><span class="co"># transform '&lt;div&gt; &lt;span&gt; toto &lt;/span&gt; &lt;p&gt; hello &lt;a href=&quot;http://tur'</span></a>
<a class="sourceLine" id="cb4-5" title="5"><span class="co"># into '&lt;div&gt; &lt;span&gt; toto &lt;/span&gt; &lt;p&gt; hello &lt;/p&gt;&lt;/div&gt;'</span></a>
<a class="sourceLine" id="cb4-6" title="6"><span class="kw">def</span> repair_xml( xml )</a>
<a class="sourceLine" id="cb4-7" title="7"> parents=[]</a>
<a class="sourceLine" id="cb4-8" title="8"> depth=<span class="dv">0</span></a>
<a class="sourceLine" id="cb4-9" title="9"> xml.scan(<span class="ot"> %r{&lt;(/?)(\w*)[^&gt;]*(/?)&gt;}</span> ).each <span class="kw">do</span> |m|</a>
<a class="sourceLine" id="cb4-10" title="10"> <span class="kw">if</span> m[<span class="dv">2</span>] == <span class="st">&quot;/&quot;</span></a>
<a class="sourceLine" id="cb4-11" title="11"> <span class="kw">next</span></a>
<a class="sourceLine" id="cb4-12" title="12"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb4-13" title="13"> <span class="kw">if</span> m[<span class="dv">0</span>] == <span class="st">&quot;&quot;</span> </a>
<a class="sourceLine" id="cb4-14" title="14"> parents[depth]=m[<span class="dv">1</span>]</a>
<a class="sourceLine" id="cb4-15" title="15"> depth+=<span class="dv">1</span></a>
<a class="sourceLine" id="cb4-16" title="16"> <span class="kw">else</span></a>
<a class="sourceLine" id="cb4-17" title="17"> depth-=<span class="dv">1</span></a>
<a class="sourceLine" id="cb4-18" title="18"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb4-19" title="19"> <span class="kw">end</span></a>
<a class="sourceLine" id="cb4-20" title="20"> res=xml.sub(<span class="ot">/&lt;[^&gt;]*$/m</span>,<span class="st">''</span>)</a>
<a class="sourceLine" id="cb4-21" title="21"> depth-=<span class="dv">1</span></a>
<a class="sourceLine" id="cb4-22" title="22"> depth.downto(<span class="dv">0</span>).each { |x| res&lt;&lt;=<span class="ot"> %{</span><span class="st">&lt;/</span><span class="ot">#{</span>parents[x]<span class="ot">}</span><span class="st">&gt;</span><span class="ot">}</span> }</a>
<a class="sourceLine" id="cb4-23" title="23"> res</a>
<a class="sourceLine" id="cb4-24" title="24"><span class="kw">end</span></a></code></pre></div>
<p>I dont know if the code can help you, but the raisonning should definitively be known.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-05-19
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -0,0 +1,279 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Trees; Pragmatism and Formalism</title>
<meta name="keywords" content="XML, Perl, programming, tree, theory, mathematics, regexp, script" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Trees; Pragmatism and Formalism</h1>
<h2>When theory is more efficient than practice</h2>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div class="intro">
<p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span>:</p>
<ul>
<li>I tried to program a simple filter</li>
<li>Was blocked 2 days</li>
<li>Then stopped working like an engineer monkey</li>
<li>Used a pen and a sheet of paper</li>
<li>Made some math.</li>
<li>Crushed the problem in 10 minutes</li>
<li>Conclusion: The pragmatism shouldnt mean “never use theory”.</li>
</ul>
</div>
<h2 id="abstract-longer-than-tldr">Abstract (longer than <span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span>)</h2>
<p>For my job, I needed to resolve a problem. It first seems not too hard. Then I started working directly on my program. I entered in the <em>infernal</em>: <em>try &amp; repair loop</em>. Each step was like:</p>
<blockquote>
<p> Just this thing to repair and that should be done.<br />
OK, now that should just work.<br />
Yeah!!!<br />
Oops! I forgotten that…<br />
<code>repeat until death</code></p>
</blockquote>
<p>After two days of this <a href="http://fr.wikipedia.org/wiki/Sisyphe">Sisyphus</a> work, I finally just stopped to rethink the problem. I took a pen, a sheet of paper. I simplified the problem, reminded what I learned during my Ph.D. about trees. Finally, the problem was crushed in less than 20 minutes.</p>
<p>I believe the important lesson is to remember that the most efficient methodology to resolve this <em>pragmatic</em> problem was the <em>theoretical</em> one. And therefore, argues opposing science, theory to pragmatism and efficiency are fallacies.</p>
<hr />
<h1 id="first-my-experience">First: my experience</h1>
<p>Apparently 90% of programmer are unable to program a binary search without bug. The algorithm is well known and easy to understand. However it is difficult to program it without any flaw. I participated to <a href="http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/">this contest</a>. And you can see the <a href="http://reprog.wordpress.com/2010/04/21/binary-search-redux-part-1/">results here</a><a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>. I had to face a problem of the same kind at my job. The problem was simple to the start. Simply transform an <sc>xml</sc> from one format to another.</p>
<p>The source <sc>xml</sc> was in the following general format:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">&lt;rubrique&gt;</span></a>
<a class="sourceLine" id="cb1-2" title="2"> <span class="kw">&lt;contenu&gt;</span></a>
<a class="sourceLine" id="cb1-3" title="3"> <span class="kw">&lt;tag1&gt;</span>value1<span class="kw">&lt;/tag1&gt;</span></a>
<a class="sourceLine" id="cb1-4" title="4"> <span class="kw">&lt;tag2&gt;</span>value2<span class="kw">&lt;/tag2&gt;</span></a>
<a class="sourceLine" id="cb1-5" title="5"> ...</a>
<a class="sourceLine" id="cb1-6" title="6"> <span class="kw">&lt;/contenu&gt;</span></a>
<a class="sourceLine" id="cb1-7" title="7"> <span class="kw">&lt;enfant&gt;</span></a>
<a class="sourceLine" id="cb1-8" title="8"> <span class="kw">&lt;rubrique&gt;</span></a>
<a class="sourceLine" id="cb1-9" title="9"> ...</a>
<a class="sourceLine" id="cb1-10" title="10"> <span class="kw">&lt;/rubrique&gt;</span></a>
<a class="sourceLine" id="cb1-11" title="11"> ...</a>
<a class="sourceLine" id="cb1-12" title="12"> <span class="kw">&lt;rubrique&gt;</span></a>
<a class="sourceLine" id="cb1-13" title="13"> ...</a>
<a class="sourceLine" id="cb1-14" title="14"> <span class="kw">&lt;/rubrique&gt;</span></a>
<a class="sourceLine" id="cb1-15" title="15"> <span class="kw">&lt;/enfant&gt;</span></a>
<a class="sourceLine" id="cb1-16" title="16"><span class="kw">&lt;/menu&gt;</span></a></code></pre></div>
<p>and the destination format was in the following general format:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">&lt;item</span><span class="ot"> name=</span><span class="st">&quot;Menu0&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-2" title="2"> <span class="kw">&lt;value&gt;</span></a>
<a class="sourceLine" id="cb2-3" title="3"> <span class="kw">&lt;item</span><span class="ot"> name=</span><span class="st">&quot;menu&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-4" title="4"> <span class="kw">&lt;value&gt;</span></a>
<a class="sourceLine" id="cb2-5" title="5"> <span class="kw">&lt;item</span><span class="ot"> name=</span><span class="st">&quot;tag1&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-6" title="6"> <span class="kw">&lt;value&gt;</span>value1<span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-7" title="7"> <span class="kw">&lt;/item&gt;</span></a>
<a class="sourceLine" id="cb2-8" title="8"> <span class="kw">&lt;item</span><span class="ot"> name=</span><span class="st">&quot;tag2&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-9" title="9"> <span class="kw">&lt;value&gt;</span>value2<span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-10" title="10"> <span class="kw">&lt;/item&gt;</span></a>
<a class="sourceLine" id="cb2-11" title="11"> ...</a>
<a class="sourceLine" id="cb2-12" title="12"> <span class="kw">&lt;item</span><span class="ot"> name=</span><span class="st">&quot;menu&quot;</span><span class="kw">&gt;</span></a>
<a class="sourceLine" id="cb2-13" title="13"> <span class="kw">&lt;value&gt;</span></a>
<a class="sourceLine" id="cb2-14" title="14"> ...</a>
<a class="sourceLine" id="cb2-15" title="15"> <span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-16" title="16"> <span class="kw">&lt;value&gt;</span></a>
<a class="sourceLine" id="cb2-17" title="17"> ...</a>
<a class="sourceLine" id="cb2-18" title="18"> <span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-19" title="19"> <span class="kw">&lt;/item&gt;</span></a>
<a class="sourceLine" id="cb2-20" title="20"> <span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-21" title="21"> <span class="kw">&lt;/item&gt;</span></a>
<a class="sourceLine" id="cb2-22" title="22"> <span class="kw">&lt;/value&gt;</span></a>
<a class="sourceLine" id="cb2-23" title="23"><span class="kw">&lt;/item&gt;</span></a></code></pre></div>
<p>At first sight I believed it will be easy. I was so certain it will be easy that I fixed to myself the following rules:</p>
<ol type="1">
<li>do not use <sc>xslt</sc></li>
<li>avoid the use of an <sc>xml</sc> parser</li>
<li>resolve the problem using a simple perl script[^2]</li>
</ol>
<p>You can try if you want. If you attack the problem directly opening an editor, I assure you, it will certainly be not so simple. I can tell that, because its what Ive done. And I must say I lost almost a complete day at work trying to resolve this. There was also, many small problems around that make me lose more than two days for this problem.</p>
<p>Why after two days did I was unable to resolve this problem which seems so simple?</p>
<p>What was my behaviour (workflow)?</p>
<ol type="1">
<li>Think</li>
<li>Write the program</li>
<li>Try the program</li>
<li>Verify the result</li>
<li>Found a bug</li>
<li>Resolve the bug</li>
<li>Go to step 3.</li>
</ol>
<p>This was a <em>standard</em> workflow for computer engineer. The flaw came from the first step. I thought about how to resolve the problem but with the eyes of a <em>pragmatic engineer</em>. I was saying:</p>
<blockquote>
<p>That should be a simple perl search and replace program.<br />
Lets begin to write code</p>
</blockquote>
<p>This is the second sentence that was plainly wrong. I started in the wrong direction. And the workflow did not work from this entry point.</p>
<h2 id="think">Think</h2>
<p>After some times, I just stopped to work. Tell myself <em>“it is enough, now, I must finish it!”</em>. I took a sheet of paper, a pen and began to draw some trees.</p>
<p>I began by make by removing most of the verbosity. I first renamed <code>&lt;item name="Menu"&gt;</code> by simpler name <code>M</code> for example. I obtained something like:</p>
<img src="code/The_source_tree.png" alt="The source tree" />
<p>and</p>
<img src="code/The_destination_tree.png" alt="The destination tree" />
<p>Then I made myself the following reflexion:</p>
<p>Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my <sc>xml</sc> source<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>. We consider three atomic transformations on trees:</p>
<ul>
<li><em>substitution</em>: renaming a node</li>
<li><em>insertion</em>: adding a node</li>
<li><em>deletion</em>: remove a node</li>
</ul>
<p>One of the particularity of atomic transformations on trees, is ; if you remove a node, all children of this node, became children of its father.</p>
<p>An example:</p>
<pre class="twilight">
r - x - a
\ \
\ b
y - c
</pre>
<p>If you delete the <code>x</code> node, you obtain</p>
<pre class="twilight">
a
/
r - b
\
y - c
</pre>
<p>And look at what it implies when you write it in <sc>xml</sc>:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb3-1" title="1"><span class="kw">&lt;r&gt;</span></a>
<a class="sourceLine" id="cb3-2" title="2"> <span class="kw">&lt;x&gt;</span></a>
<a class="sourceLine" id="cb3-3" title="3"> <span class="kw">&lt;a&gt;</span>value for a<span class="kw">&lt;/a&gt;</span></a>
<a class="sourceLine" id="cb3-4" title="4"> <span class="kw">&lt;b&gt;</span>value for b<span class="kw">&lt;/b&gt;</span></a>
<a class="sourceLine" id="cb3-5" title="5"> <span class="kw">&lt;/x&gt;</span></a>
<a class="sourceLine" id="cb3-6" title="6"> <span class="kw">&lt;y&gt;</span></a>
<a class="sourceLine" id="cb3-7" title="7"> <span class="kw">&lt;c&gt;</span>value for c<span class="kw">&lt;/c&gt;</span></a>
<a class="sourceLine" id="cb3-8" title="8"> <span class="kw">&lt;/y&gt;</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="kw">&lt;/r&gt;</span></a></code></pre></div>
<p>Then deleting all <code>x</code> nodes is equivalent to pass the <sc>xml</sc> via the following search and replace script:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb4-1" title="1"><span class="kw">s/</span><span class="ot">&lt;\/</span><span class="ch">?</span><span class="ot">x&gt;</span><span class="kw">//g</span></a></code></pre></div>
<p>Therefore, if there exists a one state deterministic transducer which transform my trees ; I can transform the <sc>xml</sc> from one format to another with just a simple list of search and replace directives.</p>
<h1 id="solution">Solution</h1>
<p>Transform this tree:</p>
<pre class="twilight">
R - C - tag1
\ \
\ tag2
E -- R - C - tag1
\ \ \
\ \ tag2
\ E ...
R - C - tag1
\ \
\ tag2
E ...
</pre>
<p>to this tree:</p>
<pre class="twilight">
tag1
/
M - V - M - V - tag2 tag1
\ /
M --- V - tag2
\ \
\ M
\ tag1
\ /
V - tag2
\
M
</pre>
<p>can be done using the following one state deterministic tree transducer:</p>
<blockquote>
<p>C -&gt; ε<br />
E -&gt; M<br />
R -&gt; V</p>
</blockquote>
<p>Wich can be traduced by the following simple search and replace directives:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb5-1" title="1"><span class="kw">s/</span><span class="ot">C</span><span class="kw">//g</span></a>
<a class="sourceLine" id="cb5-2" title="2"><span class="kw">s/</span><span class="ot">E</span><span class="kw">/</span><span class="st">M</span><span class="kw">/g</span></a>
<a class="sourceLine" id="cb5-3" title="3"><span class="kw">s/</span><span class="ot">R</span><span class="kw">/</span><span class="st">V</span><span class="kw">/g</span></a></code></pre></div>
<p>Once adapted to <sc>xml</sc> it becomes:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode perl"><code class="sourceCode perl"><a class="sourceLine" id="cb6-1" title="1"><span class="kw">s%</span><span class="ot">&lt;/</span><span class="ch">?</span><span class="ot">contenu&gt;</span><span class="kw">%%g</span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="kw">s%</span><span class="ot">&lt;enfant&gt;</span><span class="kw">%</span><span class="st">&lt;item name=&quot;menu&quot;&gt;</span><span class="kw">%g</span></a>
<a class="sourceLine" id="cb6-3" title="3"><span class="kw">s%</span><span class="ot">&lt;/enfant&gt;</span><span class="kw">%</span><span class="st">&lt;/item&gt;</span><span class="kw">%g</span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="kw">s%</span><span class="ot">&lt;rubrique&gt;</span><span class="kw">%</span><span class="st">&lt;value&gt;</span><span class="kw">%g</span></a>
<a class="sourceLine" id="cb6-5" title="5"><span class="kw">s%</span><span class="ot">&lt;/rubrique&gt;</span><span class="kw">%</span><span class="st">&lt;/value&gt;</span><span class="kw">%g</span></a></code></pre></div>
<p>That is all.</p>
<h1 id="conclusion">Conclusion</h1>
<p>It should seems a bit paradoxal, but sometimes the most efficient approach to a pragmatic problem is to use the theoretical methodology.</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>Hopefully I am in the 10% who had given a bug free implementation.<a href="#fnref1" class="footnote-back"></a></p></li>
<li id="fn2"><p>I did a program which generate automatically the weight in a matrix of each edit distance from data.<a href="#fnref2" class="footnote-back"></a></p></li>
</ol>
</section>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-05-24
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - multi language choices</title>
<meta name="keywords" content="multilanguage, blog" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-06-14-multi-language-choices/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>multi language choices</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I translate most of my blog entries in French and English. Most people advice me to have one file per language. Generally it ends with:</p>
<pre class="twilight">
Bonjour,
voici un exemple de texte en français.
[image](url)
</pre>
<pre class="twilight">
Hello,
here is an example of english text.
[image](url)
</pre>
<p>This way of handling translations force you to write completely an article in one language, copy it, and translate it.</p>
<p>However, most of time, there are common parts like images, source code, etc… When I want to correct some mistake on these parts, I have to make twice the work. With sometimes adding another mistake in only one language.</p>
<p>This is why I preferred to handle it differently. I use <em>tags</em> on a single file. Finally my files looks like:</p>
<pre class="twilight">
fr: Bonjour,
en: Hello,
en: here is an example of english text.
fr: voici un exemple de texte en français.
[image](url)
</pre>
<p>As I edit my files with <a href="http://vim.org">vim</a>, it is really easy to add <code>fr:</code> or <code>en:</code> at some lines beginning using the useful <code>C-v</code>. However <a href="http://nanoc.stoneship.org">nanoc</a> was conceived to be used for one language only. Or to be used with the first method. I tried to adapt nanoc to my usage. But after a while, I found it easier to pre-filter the nanoc work by a simple script. My script transform my file into two new files. And all work like a charm.</p>
<p>You can get my blog code source (without most of articles) at <a href="http://github.com/yogsototh/Scratch">github.com/yogsototh/Scratch</a>.</p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-06-14-multi-language-choices/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-06-14-multi-language-choices/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-06-14
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Get my blog engine</title>
<meta name="keywords" content="blog, nanoc" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
<link href="https://ieji.de/@yogsototh" rel="me">
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/2010-06-15-Get-my-blog-engine/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Get my blog engine</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<p>I published a <em>light</em> version of my blog engine based on <a href="http://nanoc.stoneship.org">nanoc</a> yesterday night. By <em>light</em>, I mean a lighter, more portable CSS (without round border). You can get it on <a href="http://github.com/yogsototh/nanoc3_blog">github.com</a>.</p>
<p>What this system provide?</p>
<ul>
<li>All <a href="http://nanoc.stoneship.org">nanoc</a> advantages,</li>
<li>Easy multi-language handling,</li>
<li>Syntax Coloration for most languages,</li>
<li><a href="http://intensedebate.org">intenseDebate</a> comments integration (asynchronous) ;</li>
<li>Portable with and without javascript, XHTML Strict 1.0 / CSS3,</li>
<li>Write in markdown format (no HTML editing needed),</li>
<li>Typographic ameliorations (no : starting a line in French for example),</li>
<li><a href="http://graphviz.org">Graphviz</a> graph generation integration.</li>
</ul>
<hr />
<h1 id="main-documentation-page">Main Documentation Page</h1>
<h1 id="use-it-now">Use It NOW!</h1>
<p>Once installed (follow the README.md instructions).</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode zsh"><code class="sourceCode zsh"><a class="sourceLine" id="cb1-1" title="1">$ <span class="kw">cd</span> /root/of/nanoc3_blog</a>
<a class="sourceLine" id="cb1-2" title="2">$ ./task/new_blog_entry Title of the blog</a>
<a class="sourceLine" id="cb1-3" title="3">$ vi latest.md</a>
<a class="sourceLine" id="cb1-4" title="4">$ ./task/recompile</a></code></pre></div>
<p>Now your website reside into the <code>output</code> directory.</p>
<hr />
<h1 id="documentation">Documentation</h1>
<h2 id="useful-things-to-know">Useful things to know</h2>
<h3 id="multi-language">Multi-language</h3>
<p>All files in <code>multi</code> are processed and copied in the <code>content</code> directory. For each file in multi, each line starting by <code>fr:</code> are copied (without the <code>fr:</code> into the <code>content/html/fr/</code> tree, but not into the <code>content/html/en</code> tree. File not starting by <code>fr:</code> or <code>en:</code> are copied in each destinations.</p>
<p>If you want to add another language, youll have to modify <code>tasks/config</code>, and <code>config.yaml</code>, create a <code>content/html/xx</code> where <code>xx</code> is the language code.</p>
<h3 id="edition-rendering">Edition &amp; Rendering</h3>
<h4 id="additional-keywords">additional keywords</h4>
<p>You can separate multi content div using the: <code>n``ewcorps</code> directive (see examples).</p>
<p>You can create div using <code>b``egindiv(classname)</code>, <code>e``nddiv</code>. (See some existing blog entries for example). Use the class <code>intro</code> for the abstract part.</p>
<p>You can create nice description table using <code>&lt;``desc&gt;</code> (See source code for example).</p>
<h4 id="typography">Typography</h4>
<p>In French all :, ;, ! and ? are preceded automatically by <code>&amp;nbsp</code>. This enable not to have a line starting by a single special character.</p>
<p>You can use small caps using <code>&lt;sc&gt;</code> tags.</p>
<ul>
<li><code>(c``)</code> is replaced by (c).</li>
<li><code>(r``)</code> is replaced by (r).</li>
<li><code>&lt;``-</code> is replaced by &lt;-.</li>
<li><code>-``&gt;</code> is replaced by -&gt;.</li>
</ul>
<h4 id="source-code">source code</h4>
<p>To write source code you should use the following format:</p>
<p>~~~~~~ {.html} ~~~~~~ {.ruby} The code </cOde> ~~~~~~</p>
<p>The <code>file</code> attribute is not required.</p>
<h3 id="blog">blog</h3>
<p>If you want to make really long blog post, you can separate them into many files. To accomplish that, you simply have to make your files like:</p>
<pre class="twilight">
multi/blog/2010-06-01-the-title.md
multi/blog/2010-06-01-the-title/second_part.md
multi/blog/2010-06-01-the-title/third_part.md
</pre>
<h3 id="mobileme">mobileme</h3>
<p>All files are intended to be generated into the <code>output/Scratch</code> directory. This was made like that to work nicely with iWeb organisation of websites.</p>
<h3 id="menu">menu</h3>
<p>The order of post is done using the <code>menupriority</code> meta-data in the header of the files.</p>
<p>You can hide some file from the menu by setting: <code>isHidden: true</code> in the header.</p>
<h2 id="details">Details</h2>
<p>To know more about this blog engine, you should look at <a href="http://nanoc.stoneship.org">nanoc</a> project.</p>
<p>Then look at the files inside your project:</p>
<p><desc> README.md : readme for the project (used by github) :: latest.md : symbolic link to the last blog entry :: multi/ : Directory containing multi-language articles :: tasks/ : scripts for website live :: config.yaml : global configuration file :: Rules : generation rules :: content/ : content files processed by nanoc :: layouts/ : erb templates :: lib/ : ruby libraries used to process files :: output/ : website :: Rakefile : not mandatory for this blog :: </desc></p>
</div>
<div id="afterarticle">
<div id="social">
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-06-15-Get-my-blog-engine/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/2010-06-15-Get-my-blog-engine/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
<a href="/about-me.html">About</a>
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2010-06-15
</div>
<div>
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more