Skip to content

Instantly share code, notes, and snippets.

View billerby's full-sized avatar
🏠
Working from home

Erik Billerby billerby

🏠
Working from home
  • Redpill Linpro
  • Göteborg, Sweden
View GitHub Profile
// The userid:s comes as one string separated by pipes (|), tokenize it.
$users = $_POST["markedUsers"];
$tok = strtok($users, "|");
while ($tok !== false) {
// Get the user and generate a new password.
require_once( ABSPATH . 'wp-includes/class-phpass.php');
$password = wp_generate_password(12, false);
$wp_hasher = new PasswordHash(8, TRUE);
$cryptedpassword = $wp_hasher->HashPassword($password);
UPDATE wp_posts SET guid = REPLACE ( guid, 'http://old.domain.com', 'http://new.domain.com');
UPDATE wp_posts SET post_content= REPLACE ( post_content, 'http://old.domain.com', 'http://new.domain.com');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old.domain.com', 'http://new.domain.com') WHERE LEFT(option_value, 2) <> 'a:';
a:1:{i:0;s:31:"http://gammal.url.com/wordpress";}
define('WP_HOME','http://ny.url/wordpress');
define('WP_SITEURL','http://ny.url/wordpress');
@billerby
billerby / alfresco_backup.bat
Created November 17, 2011 13:27
Alfresco offline backup for Windows
@ECHO OFF
REM Alfresco backup script
REM Version 1.01, Updated: 2011-11-17
REM By Erik Billerby, billerby[-at-]gmail.com
REM Performs a full offline backup of Alfresco.
REM Location where 7-Zip is installed on your computer.
REM The default is in a folder, '7-Zip' in your Program Files directory.
@billerby
billerby / git_branch_prompt
Created January 25, 2012 07:15
Show git branch on your bash prompt...
#showing git branches in bash prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local YELLOW="\[\033[0;33m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@billerby
billerby / gist:2686740
Created May 13, 2012 07:38
torvalds commit log standard
Also, please write good git commit messages. A good commit message
looks like this:
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
@billerby
billerby / alfresco
Created August 31, 2012 08:55
alfresco startup deamon script set to run by another user than root
#!/bin/sh
#
# chkconfig: 2345 80 30
# description: Alfresco Enterprise
#
RETVAL=0
start () {
su -m ec2-user -c "cd /opt/alfresco && /opt/alfresco/alfresco.sh start" "$2"
<Loftux> I have this in my .bash_aliases file
ff(){
find $1 -name "*.$2" -not -name "*min.js"|xargs grep -i $3
}
[16:08] <Loftux> ff <startdir> <type of file> <search term>
[16:08] <Loftux> The I can search alfresco source very convenient,like if I want to find something how its done by alfresco:
[16:08] <Loftux> ff tomcat/webapps/share/ js doBeforeDialogShow
@billerby
billerby / update-jira-readme
Created September 6, 2012 07:35
Jira update WC
# Log in as root
# create user jira
useradd jira:jira (leta reda på bra exempel)
passwd jira
run visudo
# ADD at the end of the file:
"jira ALL=(ALL) ALL"