Skip to content

Instantly share code, notes, and snippets.

View elebescond's full-sized avatar

LE BESCOND Erwan elebescond

View GitHub Profile
@elebescond
elebescond / gist:1336202
Created November 3, 2011 10:20
Extract unique IP from Apache log
awk '{ print $1 } ' apache_log | sort | uniq
@elebescond
elebescond / gist:1336580
Created November 3, 2011 14:14
Wordpress how to register admin options
<?php
add_action( 'admin_init', 'myplugin_admin_init' );
function myplugin_admin_init() {
//register settings
register_setting( 'myplugin_options_group1', 'myplugin_option_1' );
}
// create custom plugin settings menu
@elebescond
elebescond / screen_memo.txt
Created November 29, 2011 09:35
screen memo
elebescond@elebescond:~$ screen bash
press CTRL+A followed by d to detach the screen.
[detached from 5883.pts-1.elebescond]
elebescond@elebescond:~$ screen -ls
There is a screen on:
5883.pts-1.elebescond (29/11/2011 10:23:02) (Detached)
1 Socket in /var/run/screen/S-elebescond.
elebescond@elebescond:~$ screen -r 5883.pts-1.elebescond
elebescond@elebescond:~$ screen -d 5883.pts-1.elebescond
@elebescond
elebescond / gist:1432910
Created December 5, 2011 08:51
Equivalent du svn revert avec git
Par fichier:
svn revert path/to/file ==> git checkout path/to/file
Working copy
git reset --hard
@elebescond
elebescond / gist:1433137
Created December 5, 2011 10:24
Generate a pot template from a wordpress theme - xgettext
find . -iname "*.php" > /tmp/my_theme_file_list.txt
# new template
xgettext --from-code=utf-8 -d my_theme -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
# update template
xgettext --from-code=utf-8 -d my_theme -j -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
@elebescond
elebescond / gist:1472310
Created December 13, 2011 14:31
Module git
git submodule add git://github.com/xxx/yyy.git yyy
majewan@majewan:/tmp$ wget http://www.les-horaires.fr/go/130
–2012-01-02 12:17:30– http://www.les-horaires.fr/go/130
Résolution de www.les-horaires.fr… 91.121.110.157
Connexion vers www.les-horaires.fr|91.121.110.157|:80… connecté.
requête HTTP transmise, en attente de la réponse… 302 Moved Temporarily
Emplacement: http://ad.zanox.com/ppc/?13566869C1968578671T [suivant]
–2012-01-02 12:17:30– http://ad.zanox.com/ppc/?13566869C1968578671T
Résolution de ad.zanox.com… 217.110.110.231
Connexion vers ad.zanox.com|217.110.110.231|:80… connecté.
requête HTTP transmise, en attente de la réponse… 302 Moved Temporarily
@elebescond
elebescond / .gitignore
Created January 30, 2012 08:38
gitignore for eclipse grails project
*.iws
*Db.properties
*Db.script
.settings
eclipse
grails-app/conf/DataSource.groovy
stacktrace.log
target
target-eclipse
/plugins
@elebescond
elebescond / gist:3090789
Created July 11, 2012 14:37
replace url in wordpress post content
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://oldlink.com', 'http://newlink.com');
git remote show origin
git checkout --track -b branch_name origin/branch_name
or
git checkout -t origin/branch_name
git remote show origin