playing with cat and awk
cat can print out line number and awk lets you format it. This combo is excellent to manipulate files
creating a csv for eg.
cat -n phpbook.csv | awk '{print $2","$1}' > phpbook1.csv
cat can print out line number and awk lets you format it. This combo is excellent to manipulate files
creating a csv for eg.
cat -n phpbook.csv | awk '{print $2","$1}' > phpbook1.csv
suppose one accidentally commited a file with sensitive data ages ago, others could actually retrieve the passwd easily since git keeps a history of the changes. So the idea is to remove the file from git altogether with file changed history, then recommit the affected file (without sensitive data this time) again.
do a git pull and git fetch –tags on original repo, then copy the repo to a tmp repo and apply the commands to the tmp repo like so:
git pull
git fetch --tags
git filter-branch --index-filter 'git rm --cached --ignore-unmatch wp-config.*' --tag-name-filter 'cat' HEAD --all
(if you have uncommited changes, you will get "Cannot rewrite branches with a dirty working directory." error. Do a git commit to fix the error.)
After that, copy the affected files (wp-config.* in this case) from the old repo back to the tmp repo and force push from the tmp repo.
git push origin master --force
do it for other branches affected.
If using github, the only way is to remove the repo and recreate a new one. In the tmp repo
git push origin master
(or push any other branches if need be)
git push --tags
see also http://help.github.com/remove-sensitive-data/ and http://kernel.org/pub/software/scm/git/docs/v1.6.0.6/git-filter-branch.html
if vbulletin is behind a proxy, the ip of the user would be the ip of the proxy server instead of the ip of the user. Instead of hacking the includes/class_core.php file we can install the runkit extension, ie http://www.php.net/manual/en/runkit.installation.php
then create a plugin consisting of the following:
$vbulletin->ipaddress = $vbulletin->alt_ip;
runkit_constant_redefine('IPADDRESS', $vbulletin->ipaddress);
sometimes it may be necessary to change the domain name of your wordpress blog. Instead of reinstalling wordpress, we can modify the current database to accomodate the changes. run the following query:
Back up your db. then
use wordpress_db;
update wp_site set domain='newdomain.com';
update wp_blogs set domain='newdomain.com';
update wp_options SET option_value = 'http://newdomain.com' WHERE wp_options.option_id =1;
update wp_options SET option_value = 'http://newdomain.com/wp-content/uploads' WHERE wp_options.option_id =17;
update wp_options SET option_value = 'http://newdomain.com' WHERE wp_options.option_id =46;
Many people who bought macs in 2010 are experiencing random crashes with NVRM error. After a bit of digging, the problem could be drilled down into the nvidia card for the 2010 batch of macs. If you are using Nvidia Geforce GT 330M, you might be a victim as well.
“A number of people with 2010 MacBook Pro systems configured with Core i7 GPUs and Nvidia graphics cards are reporting an issue where the systems periodically crash with a kernel panic.”
http://geekbooth.com/osx-lion-black-screen-issue
Changing the hardware doesn’t fix the problem because there is fundamentally something wrong with the apple driver – not the official nvidia driver.
The best fix is to install http://codykrieger.com/gfxCardStatus
On the gfx status icon on the top right, change the option to “integrated only”. This will force your mac to use the integrated graphic card and not the nvidia card. Restart your machine after that.