Skip to content

Instantly share code, notes, and snippets.

View mipmip's full-sized avatar
🐟

Pim Snel mipmip

🐟
View GitHub Profile
@mipmip
mipmip / ext_conf_template.txt
Created February 14, 2012 21:11
TYPO3: ext_conf_template.txt fast explanation
# cat=basic; type=string; label=conf1 label : description conf 1
conf1 = 1,2,4,5
@mipmip
mipmip / gist:1830511
Created February 14, 2012 21:15
TYPO3: useful db methods
<?php
// create where clause for query with all enable/delete/start/stop fields
$wherequery = $this->cObj->enableFields('fe_users');
// enable fields in exec_SELECTquery
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ($fields, $table, '1=1' . $this->cObj->enableFields($table), $groupBy, $orderBy);
// exec_SELECTgetRows returns an array
$userArr = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'uid,name,username,tx_lwhellocolleague_birthday as birthdayDate', 'fe_users','1=1'. $this->cObj->enableFields('fe_users'));
@mipmip
mipmip / gist:1830519
Created February 14, 2012 21:16
TYPO3: some db debug methods
<?php
function debugDatabase()
{
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = true;
$GLOBALS['TYPO3_DB']->debugOutput = true;
debug($GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
t3lib_div::devLog('dbgdb','p3ga',0,array($GLOBALS['TYPO3_DB']->debug_lastBuiltQuery));
}
@mipmip
mipmip / TCE image configuration.xml
Created February 14, 2012 21:17
TemplaVoila TCE image configuration
<TCEforms type="array">
<label>Cover Image</label>
<config type="array">
<type>group</type>
<internal_type>file</internal_type>
<allowed>gif,png,jpg,jpeg,ai,psd,tif,tiff,eps,pdf</allowed>
<max_size>10000</max_size>
<uploadfolder>uploads/tx_templavoila</uploadfolder>
<show_thumbs>1</show_thumbs>
<size>1</size>
@mipmip
mipmip / gist:1844353
Created February 16, 2012 12:00
Mac OS X: restart mDNSResponder
Load up Terminal (Applications > Utilities > Terminal.app) and type the following.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
To turn it back on, just do the opposite:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
@mipmip
mipmip / disableipv6.sh
Created February 16, 2012 12:02
OSX: disable ipv6
#!/bin/sh
IFS=$'\n'
net=`networksetup -listallnetworkservices | grep -v asterisk`
for i in $net
do
networksetup -setv6off "$i"
done
exit 0
@mipmip
mipmip / gist:1844372
Created February 16, 2012 12:03
SQL: search and replace
UPDATE egw_wiki_pages SET wiki_body = replace(`wiki_body`,"http://www.domain.nl/wiki/images/","http://xxx.domain.nl/imgwiki/") where wiki_name='XOR';
UPDATE table SET column = replace(column, regex '%-%', ' ') where id = xxx;
@mipmip
mipmip / gist:1844380
Created February 16, 2012 12:05
SQL: remove duplicate records
CREATE TEMPORARY TABLE keepids (
SELECT MIN(uid) FROM tt_address
GROUP BY (email)
);
DELETE FROM tt_address WHERE uid NOT IN (SELECT * FROM keepids);
DROP TABLE keepids;
@mipmip
mipmip / gist:1844407
Created February 16, 2012 12:10
SQL: grant privileges
GRANT ALL PRIVILEGES ON dbname.* to [email protected] IDENTIFIED BY 'dbpassword';
FLUSH PRIVILEGES;
@mipmip
mipmip / copydbmysql.sh
Created February 16, 2012 12:12
copy mysql database in bash
#!/bin/sh
export APASS=rootpassword
export DB=dbname
export DBDEST=newdbname
mysqldump -uroot $DB -p$APASS | mysql -uroot -p$APASS $DBDEST