DokuWiki

It's better when it's simple

User Tools

Site Tools


tips

This is an old revision of the document!


Linux Notes

Stop MSBuild VS, holds files open

 MSBUILDDISABLENODEREUSE=1

zip all folders

for i in * ; do
  if[[ -d "$i" ]; then]
    7z a -m5=LZMA2 $i.7z $i\*
  fi
done 

Remove_app

 aptitude purge `dpkg --get-selections | grep chrome | cut -f 1`
 aptitude -f install

Linux_Backups

NOW=$(date +"%Y.%m.%d.%H.%M")
tar cxf file.${NOW}.tar.gz dir
 update user set Password=PASSWORD('secret') where User='root';

Default_route

 route add default gw <server> dev eth0

Python_and_Django

Apache_restrictive_deny_on_virthosts

Default settings for DocumentRoot in http.conf

  Order deny,allow
  Deny from all

Change to

  Order allow,deny
  Allow from all

Ubantu_32-bit libraries where it only installs 64-bit

 apt-get install ia32-libs

My_IP_Addresses

Reset_MYSQL_Root_Password

Reset Forgotten MySQL Root Password

Have you ever forgotten the root password on one of your MySQL servers? No? Well maybe I’m not as perfect as you. This is a quick h00tow (how to) reset your MySQL root password. It does require root access on your server. If you have forgotten that password wait for another article. Original article posted on reset mysql root password.

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

 mysqld_safe --skip-grant-tables &

You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.

 mysql --user=root mysql
 update user set Password=PASSWORD('new-password') where user='root';
 flush privileges;
 exit;

Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.

Deleteed user -

 CREATE USER 'root'@'localhost' IDENTIFIED BY 'uhop12xvg2100';
 INSERT INTO user (Host,User,Password) VALUES('localhost','root',PASSWORD('uhop12xvg2100'));

In my case I'd deleted root user for 127.0.0.1, but localhost was still there. Was able to login in using the port directly using:

 mysql --protocol=tcp --port=3306 -h127.0.0.1 -u root -p

Then update the privilages

 GRANT ALL PRIVILEGES ON * TO 'root'@'localhost' IDENTIFIED BY 'uhop12xvg2100' WITH GRANT OPTION;

Doctorine

Bash_one_liners

Sendmail_Config

Named_Config

EEE_900

Ubantu

Cygwin

SSH_public_keys

VMware AVG Firewall

Rename_network_adaptors

unix version

 uname -a

Search and replace in files

#!/bin/bash
# base file that will be 'copied', also the search string
BASENAME='romp.net.nz'
# text array of the resulting file names, and the replace string
RESULTNAMES='rompnet.com rompnet.co.nz rompnet.co.uk'
# for loop thru the text array
for RESNAME in ${RESULTNAMES}; do
        echo "Making ${RESNAME}"
        sed "s/${BASENAME}/${RESNAME}/g" ${BASENAME} > ${RESNAME}
done
 sed -i 's/20[[0-1][[0-9]\{7\}/'`date +%Y%m%d%I`'/g' *.zone]
 sed -i 's/FileInfo/All/g' *.conf

Decode Base64 email

 php -r 'echo base64_decode($argv[[1]);' 'PGh0bWw+DQo....blah....DwvaHRtbD4=']

ntp without daemon

 ntpdate time.nist.gov 1> /dev/null 2> /dev/null

remove duplicate lines

 sort /etc/hosts.deny | uniq -u > /etc/hosts.deny.new

add cygwin program as a windows service

run cygwin as admin

 cygrunsrv -I "CYGWIN mysql" --path /usr/local/mysql/bin/mysqld.exe -a "arguments"

smb.conf

 follow symlinks = yes
 wide links = yes
 unix extensions = no

make a subdir/dir

 mkdir -p /tmp/new/folder

delete a user

 passwd --delete username

Linux_Embedded_quick_commands

Temporarily_disable_an_alias

prefix the command with \

Chmod_all_files_in_subfolders_but_not_the_folders

 find ./ -type f | while read var; do chmod 664 $var; done

Chmod_some_files_in_subfolders_but_not_the_folders

 find ./ -type f | egrep "[[^\.c\.h\.am\.txt]$" | while read var; do chmod 775 ]$var; done

Chmod_all_folders_in_subfolders_but_not_files

 find ./ -type d | while read var; do chmod a+x "$var"; done

Chmod_.sh files in subfolders

 find ./ -type f | grep ".sh$" | while read var; do chmod 775 $var; done

Remove_all_files_except_in_folder_.svn

 find ./ -type f | grep -v ".svn" | while read var; do rm -fv $var; done

Remove_all_sub-folders called .svn

 find ./ -type d | grep ".svn" | while read var; do rm -rfv $var; done

sql_search_and_replace

 update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

out comments

 grep -e "^[[^#]" sources.list]

grep html tags

 /<\/?\w+((\s+(\w|\w[[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[[^'\">\s]+))?)+\s*|\s*)\/?>/]i

grep square tags

 \[[\/?\w+((\s+(\w|\w[[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[[^'\">\s]+))?)+\s*|\s*)\/?\]]

**Suse locks after first boot**

On a Linux host with an XFree86 3.x X server, it is best not to run a screen saver in the guest operating system. Guest screen savers that demand a lot of processing power can cause the X server on the host to freeze.

When you are installing SuSE Linux 7.1 in text mode and the guest operating system reboots for the first time, the Linux boot sequence reaches “Starting syslog system,” then the display turns completely black and the guest appears to be hung.

Despite its appearance, the guest operating system actually is not hung; instead, the screen is not being displayed. To see the screen and continue with the installation, in the guest operating system, switch to Linux virtual console 2. Press Ctrl-Alt, press and release the spacebar, then press F2.

Then return to virtual console 1. Press Ctrl-Alt, press and release the spacebar, then press F1. You should be able to see the screen and continue installing the guest operating system.

Note: If you are using a different hot-key combination, use that in place of Ctrl-Alt above.

Note: This problem appears only when you install the guest operating system in text mode.

busybox_diff_bin_name

apply multiple patch files

 for i in {1..25}; do patch -p0 < ../patches/bash43-0`printf '%02d' "$i"`; done

Putty ignores num-keypad

Application Keypad Mode is designed to send escape sequences

 Terminal > Features > Disable Application Keypad Mode = Off

Debian network setup

Phpmyadmin session timeout

phpmyadmin/config.inc.php

 $cfg[['LoginCookieValidity'] = <your_new_timeout>;]

apache php.ini

 session.gc_maxlifetime=<your_new_timeout>

Phpmyadmin hide databases

phpmyadmin/config.inc.php

 $cfg[['Servers'][[$i][['hide_db'] = '^(]information_schema|performance_schema|mysql)$';
 
tips.1462701529.txt.gz · Last modified: 2016-05-08 11:58 by 203.79.107.114

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki