/etc/init.d/mysql stop
Create a text file
UPDATE mysql.user SET Password=PASSWORD('XXX') WHERE User='root';
FLUSH PRIVILEGES;
Start MySQL in safe mode with init file
mysqld_safe --init-file=/path/of/your/file
Stop and start the mysql server and you should be able to login!
:)
Sunday, December 14, 2014
Saturday, December 13, 2014
Python - Dad Chinese Subtitles - Creating the correct chinese srt file
And so usually i will have some problems downloading movies for my dad.
My dad have strict criteria for those movies.
They must be high res ( 480p and above ) and MUST Have chinese subtitles as his "english" isnt that great....
And which movies usually has chinese subtitles?
Not a lot....
And so, there is a need for the english subtitles to be translated to chinese and "hopefully" be playable in his VLC.
But the translated "chinese" file converted using google translate is unable to play well... because there seems to be font error on the timecode... so... here is a "tested only once" script that seems to work...
=== CODE ===
#!/usr/bin/python
import sys
with open("english.srt") as f:
english_content = f.readlines()
with open("chinese.srt") as f:
chinese_content = f.readlines()
#print english_content[0]
#print english_content[1]
#print english_content[2]
#print chinese_content[2]
def keeporthrow(mystring):
try:
int(mystring[0])
return True
except ValueError:
return False
#print keeporthrow(english_content[1])
#print keeporthrow(english_content[2])
if (len(english_content) != len(chinese_content)):
print "English file: " + str(len(english_content))
print "Chinese file: " + str(len(chinese_content))
print "Rows count dont match!"
exit
for i in range(0,len(english_content)):
#for i in range(0,10):
if keeporthrow(english_content[i]):
print english_content[i].rstrip('\n')
else:
if len(chinese_content[i]) == 1:
sys.stdout.write("\r\n")
else:
print chinese_content[i].rstrip('\n')
=== CODE ===
My dad have strict criteria for those movies.
They must be high res ( 480p and above ) and MUST Have chinese subtitles as his "english" isnt that great....
And which movies usually has chinese subtitles?
Not a lot....
And so, there is a need for the english subtitles to be translated to chinese and "hopefully" be playable in his VLC.
But the translated "chinese" file converted using google translate is unable to play well... because there seems to be font error on the timecode... so... here is a "tested only once" script that seems to work...
=== CODE ===
#!/usr/bin/python
import sys
with open("english.srt") as f:
english_content = f.readlines()
with open("chinese.srt") as f:
chinese_content = f.readlines()
#print english_content[0]
#print english_content[1]
#print english_content[2]
#print chinese_content[2]
def keeporthrow(mystring):
try:
int(mystring[0])
return True
except ValueError:
return False
#print keeporthrow(english_content[1])
#print keeporthrow(english_content[2])
if (len(english_content) != len(chinese_content)):
print "English file: " + str(len(english_content))
print "Chinese file: " + str(len(chinese_content))
print "Rows count dont match!"
exit
for i in range(0,len(english_content)):
#for i in range(0,10):
if keeporthrow(english_content[i]):
print english_content[i].rstrip('\n')
else:
if len(chinese_content[i]) == 1:
sys.stdout.write("\r\n")
else:
print chinese_content[i].rstrip('\n')
=== CODE ===
Monday, December 01, 2014
Disable local delivery Linux
What I did to disable local delivery. I'll be using the example.com domain.
Requirements:
- example.com A entry pointing to IP address assigned to one of the eth interfaces.
- /etc/hosts defining example.com assigned to the very same IP address as above
- example.com MX records pointing to Google servers (ASPMX.L.GOOGLE.COM, etc)
- default sendmail installation (mine was on Ubuntu)
Steps:
vim /etc/mail/sendmail.mc
at the end:
define(`MAIL_HUB', `example.com.')dnl
define(`LOCAL_RELAY', `example.com.')dnl
and then:
sendmailconfig (or /etc/mail/make depending on your distro)
service sendmail restart
testing:
echo -e "To: user@example.com\nSubject: Test\nTest\n" | sendmail -bm -t -v
echo -e "To: user\nSubject: Test\nTest\n" | sendmail -bm -t -v
You should see it connecting to the google server and then you should see your mail being delivered to your Google inbox.
Copied from : http://serverfault.com/questions/65365/disable-local-delivery-in-sendmail
Sunday, November 09, 2014
Apple update time...
And so the iOS8.1 is now jailbreakable.
Upgrade your apple device to iOS8.1.
Download jailbreak stuff @ http://en.pangu.io/
Run as administrator.
Turn on airplane mode.
Jailbreak.
When it says there is no available storage, click ok.
Reboot...
Search for cydia.
Launch it to "re-adjust the disk space", will auto reboot.
Add to cydia the repo for AppSync.
http://apt.178.com
Install AppSync for iOS8 from the repo.
For "cracked" stuff...
Only Appcake seems to work for me.
Install appcake v4.83 via appcake repo at http://cydia.iphonecake.com
Reboot
For iLexRat just in case...
http://cydia.myrepospace.com/iLEXiNFO/
Upgrade your apple device to iOS8.1.
Download jailbreak stuff @ http://en.pangu.io/
Run as administrator.
Turn on airplane mode.
Jailbreak.
When it says there is no available storage, click ok.
Reboot...
Search for cydia.
Launch it to "re-adjust the disk space", will auto reboot.
Add to cydia the repo for AppSync.
http://apt.178.com
Install AppSync for iOS8 from the repo.
For "cracked" stuff...
Only Appcake seems to work for me.
Install appcake v4.83 via appcake repo at http://cydia.iphonecake.com
Reboot
For iLexRat just in case...
http://cydia.myrepospace.com/iLEXiNFO/
Wednesday, October 22, 2014
Mac OSX - Died - Time to reformat...
And so my MAC OSX decided not to boot up one fine day.
Luckily, i had my installer file. ( OSX Mavericks )
No DVD on hand, so thought i'll just pop OSX installer to thumbdrive.
Get a thumbdrive with at least 8GB.
Format it to Mac OS X Extended ( Journaled ). ( In this case called untitled )
Pop a terminal and sudo.
./YOURPATH/Install\ OS\ X.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /YOURPATH/Install\ OS\ X\ Mavericks.app --nointeraction
Wait a while, then it should be done.
Boot using thumbdrive.
But as i want to copy the files out, i've popped a terminal to copy the files to another hard disk....
But amazingly, the screen will go to sleep....
So, pop another terminal...
-> pmset -a sleep 0 displaysleep 0
Dont close the terminal, and your screen will stay on.... and on.... and on....
Luckily, i had my installer file. ( OSX Mavericks )
No DVD on hand, so thought i'll just pop OSX installer to thumbdrive.
Get a thumbdrive with at least 8GB.
Format it to Mac OS X Extended ( Journaled ). ( In this case called untitled )
Pop a terminal and sudo.
./YOURPATH/Install\ OS\ X.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /YOURPATH/Install\ OS\ X\ Mavericks.app --nointeraction
Wait a while, then it should be done.
Boot using thumbdrive.
But as i want to copy the files out, i've popped a terminal to copy the files to another hard disk....
But amazingly, the screen will go to sleep....
So, pop another terminal...
-> pmset -a sleep 0 displaysleep 0
Dont close the terminal, and your screen will stay on.... and on.... and on....
Sunday, September 14, 2014
Changing my TPLink Router to something more useful!
Well,
Since gotten my new fiber ( with the purchase of a new router ), i guess it's time to retire my old TP Link Router... But... Wait... What if i can make it be my downloader machine?
Lets go install openwrt!
And let's OPKG the following:
blkid - 2.21.2-1
block-mount - 0.2.0-9
kmod-fs-ext4 - 3.3.8-1
kmod-lib-crc16 - 3.3.8-1
kmod-scsi-core - 3.3.8-1
kmod-usb-storage - 3.3.8-1
libblkid - 2.21.2-1
libpcap - 1.1.1-2
libuuid - 2.21.2-1
swap-utils - 2.21.2-1
tcpdump - 4.2.1-3
Well, time to format my thumbdrive to ext4 and create a stupid script to fetch somewhere to download!
Since gotten my new fiber ( with the purchase of a new router ), i guess it's time to retire my old TP Link Router... But... Wait... What if i can make it be my downloader machine?
Lets go install openwrt!
And let's OPKG the following:
blkid - 2.21.2-1
block-mount - 0.2.0-9
kmod-fs-ext4 - 3.3.8-1
kmod-lib-crc16 - 3.3.8-1
kmod-scsi-core - 3.3.8-1
kmod-usb-storage - 3.3.8-1
libblkid - 2.21.2-1
libpcap - 1.1.1-2
libuuid - 2.21.2-1
swap-utils - 2.21.2-1
tcpdump - 4.2.1-3
Well, time to format my thumbdrive to ext4 and create a stupid script to fetch somewhere to download!
Wednesday, September 10, 2014
Pushing mysqldump to another server!
Server 1 need to mysqldump to server 2.
HOW HOW HOW!
mysqldump DBNAME tablename | ssh root@remoteserver.com "mysql -D dbname"
Best to use the authorized keys to ssh! So no need password lah!
HOW HOW HOW!
mysqldump DBNAME tablename | ssh root@remoteserver.com "mysql -D dbname"
Best to use the authorized keys to ssh! So no need password lah!
SSH Login without password!
On server 1
ssh-keygen -t rsa
Leave password blank
Generating public/private rsa key pair. Enter file in which to save the key (/home/root/.ssh/id_rsa): Created directory '/home/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved in /home/root/.ssh/id_rsa. Your public key has been saved in /home/root/.ssh/id_rsa.pub. The key fingerprint is: XXXXXXX
SSH to server 2 and make directory
ssh root@server2 mkdir -p .ssh
Cat your server 1 key to there
cat .ssh/id_rsa.pub | ssh root@server2 'cat >> .ssh/authorized_keys'
To test on server 1
ssh root@server2
Tuesday, July 29, 2014
Adding that damm trash can back to Kali Linux.
Click “Applications” on the toolbar, then hover on “System Tools” for a second then click on “dconf Editor.”
Expand > org> gnome > nautilus > desktop
Check and uncheck trash-icon-visible
Copied from:
http://lewiscomputerhowto.blogspot.sg/2013/09/how-to-add-trash-icon-to-kali-linuxs.html
Expand > org> gnome > nautilus > desktop
Check and uncheck trash-icon-visible
Copied from:
http://lewiscomputerhowto.blogspot.sg/2013/09/how-to-add-trash-icon-to-kali-linuxs.html
Wednesday, July 09, 2014
IPAD Firmware Updates Files for iTunes Update.
Updated my iPad.
Downloaded the firmware via iclarified.
On Windows XP :
Documents and Settings\\Application Data\Apple Computer\iTunes\iPhone Software Updates
Users\\AppData\Roaming\Apple Computer\iTunes\iPhone Software Updates
~/Library/iTunes/iPhone Software Updates
On Windows Vista/Windows 7/8:
On Mac:
Paste files in above directory.
Go iTunes > Update.
:)
External Link:
http://www.everymac.com/ultimate-mac-lookup/
http://www.iclarified.com/8500/where-to-download-ipad-firmware-files-from
Downloaded the firmware via iclarified.
On Windows XP :
Documents and Settings\
Users\
~/Library/iTunes/iPhone Software Updates
On Windows Vista/Windows 7/8:
On Mac:
Paste files in above directory.
Go iTunes > Update.
:)
External Link:
http://www.everymac.com/ultimate-mac-lookup/
http://www.iclarified.com/8500/where-to-download-ipad-firmware-files-from
Wednesday, June 18, 2014
Windows XP Dying... No more updates!!!!
Make your Windows XP = POS ( Point of Sale )
So you can update...
Notepad > Save as .reg > Double click
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\WPA\PosReady]
"Installed"=dword:00000001
Works???
So you can update...
Notepad > Save as .reg > Double click
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\WPA\PosReady]
"Installed"=dword:00000001
Works???
Debian - MySQL - Why i cannot install?
GRRRRRRRRRrrrrrrrrr
Fired up a debian template.
Could not install a stupid mysql.
2014 already... WHY LIKE THAT?
apt-get install mysql-server
XXXXXXX
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
How u fix?
nano /etc/mysql/my.cnf
Add this -> innodb_use_native_aio=0 * This should be under the [mysqld] tag
Change your root password ( which is empty because some how something screw up...)
mysqladmin -u root password NEWPASSWORD
Then suei suei if you get an error as such:
'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
cat /etc/mysql/debian.cnf
Note the password in the client section.
[client]
host = localhost
user = debian-sys-maint
password = SOMERANDOMPASSWORDHERE
socket = /var/run/mysqld/mysqld.sock
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'SOMERANDOMPASSWORDHERE';
/etc/init.d/mysql restart
*pray
Fired up a debian template.
Could not install a stupid mysql.
2014 already... WHY LIKE THAT?
apt-get install mysql-server
XXXXXXX
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
How u fix?
nano /etc/mysql/my.cnf
Add this -> innodb_use_native_aio=0 * This should be under the [mysqld] tag
Change your root password ( which is empty because some how something screw up...)
mysqladmin -u root password NEWPASSWORD
Then suei suei if you get an error as such:
'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
cat /etc/mysql/debian.cnf
Note the password in the client section.
[client]
host = localhost
user = debian-sys-maint
password = SOMERANDOMPASSWORDHERE
socket = /var/run/mysqld/mysqld.sock
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'SOMERANDOMPASSWORDHERE';
/etc/init.d/mysql restart
*pray
Wrong time again Mr Windows 2008?
Grrrrr....
One of my VM date time running windows 2008 is screwed again.
Used this to fix it once and for all...
Stop the W32Time service:
net stop w32time
Configure the external time sources
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org"
Make your PDC a reliable time source for the clients.
w32tm /config /reliable:yes
Start the w32time service:
net start w32time
The windows time service should begin synchronizing the time.
You can check the external NTP servers in the time configuration by typing:
w32tm /query /configuration
Check the Event Viewer for any errors.
*Pray
One of my VM date time running windows 2008 is screwed again.
Used this to fix it once and for all...
Stop the W32Time service:
net stop w32time
Configure the external time sources
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org"
Make your PDC a reliable time source for the clients.
w32tm /config /reliable:yes
Start the w32time service:
net start w32time
The windows time service should begin synchronizing the time.
You can check the external NTP servers in the time configuration by typing:
w32tm /query /configuration
Check the Event Viewer for any errors.
*Pray
Dealing with AWSTATS.
My friend passed me an apache log file and i've attempted to parse it to AWSTATS for more "report style" human readable format...
* history > should_be_the_steps_to_follow
Wget the file / Unzip the file
wget "http://prdownloads.sourceforge.net/awstats/awstats-7.3.zip"
unzip awstats-7.3.zip
Make a directory and move awstats there.
mkdir /usr/local/awstats/
mv * /usr/local/awstats/
cd tools/
perl awstats_configure.pl
*Follow instructions to add stuff to apache/default site.
mkdir /var/lib/awstats/ ( for temp file creation i guess )
============= Jobs Done =============
Creating a config file for awstats.
nano /etc/awstats/awstats.demo.conf ( Replace demo with a name for easy identification )
- Change your logfile path to point to the apache access log
Execute the awstats to read your log and do it's stuff.
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=demo -update
To build static pages ( reports ) for your users.
perl /usr/local/awstats/tools/awstats_buildstaticpages.pl -config=demo -update -dir=/some/directory/here/
* history > should_be_the_steps_to_follow
Wget the file / Unzip the file
wget "http://prdownloads.sourceforge.net/awstats/awstats-7.3.zip"
unzip awstats-7.3.zip
Make a directory and move awstats there.
mkdir /usr/local/awstats/
mv * /usr/local/awstats/
cd tools/
perl awstats_configure.pl
*Follow instructions to add stuff to apache/default site.
mkdir /var/lib/awstats/ ( for temp file creation i guess )
============= Jobs Done =============
Creating a config file for awstats.
nano /etc/awstats/awstats.demo.conf ( Replace demo with a name for easy identification )
- Change your logfile path to point to the apache access log
Execute the awstats to read your log and do it's stuff.
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=demo -update
To build static pages ( reports ) for your users.
perl /usr/local/awstats/tools/awstats_buildstaticpages.pl -config=demo -update -dir=/some/directory/here/
Saturday, February 01, 2014
Monday, January 06, 2014
Cydia Sources - iOS7 Finally Jailbreakable!
Added the following to my cydia sources!
http://repo.appvv.com
http://cydia.iphonecake.com
http://repocydia.com/
http://sinfuliphonerepo.com/
http://cydia.xsellize.com
Old
http://repocydia.com
http://rpetri.ch/repo
http://repo.appvv.com
http://cydia.iphonecake.com
http://repocydia.com/
http://sinfuliphonerepo.com/
http://cydia.xsellize.com
Old
http://repocydia.com
http://rpetri.ch/repo
Friday, January 03, 2014
Get Fit With Only 4 Minutes Of Exercise? YAHOO.COM
Get Fit With Only 4 Minutes Of Exercise? Let Us Introduce You To The New HIIT Workouts
Got a minute? How about 20 seconds? As HIIT (high-intensity interval training) becomes …
1. Try A 2-minute squat session:
‘As soon as you wake up, before you take your shower and brush your teeth, do 50 squats next to your bed. Nobody is looking, so you can do them in your PJs. Squats are an excellent fat burner and will only take up 2-3 minutes. Over the course of the week that’s 350 squats!’ says Dalton Wong, founder of Twenty Two Training (twentytwotraining.com).2. 4 Minutes is the new 7 minutes:
Get fit with only 4 minutes of exercise four times a week? Yes please! Tabata is comprised of an aerobic and anaerobic workout, meaning it will give you both a cardio and a muscle workout. Developed by Japanese scientist Professor Izumi Tabata, it is made up of 20 seconds of intense exercise, led by your instructor, followed by 10 seconds of rest. You repeat this set 8 times. It sounds pretty easy but is anything but: 4 minutes of Tabata is equivalent to an hour of jogging and it speeds up your metabolism so that you continue to burn more calories for a full 12 hours after your session. Yes, it’s painful, but it’s worth it. Tabata classes are available at Fitness First (fitnessfirst.co.uk).3. The A-list's 5-minute metaboLic plan:
Dalton shares the quick-fix weight loss and body-sculpting secrets he uses as a trainer to the stars. Set a timer for 5 minutes and perform as many circuits as possible without rest. 1) 10 lunges forward on each leg 2) 10 push-ups 3) 10 reverse lunges on each leg 4) 10 tricep dips 5) 10 squat jumps.Record how many you can complete in 5 minutes and aim to beat that time each week.
4. The ‘20 minutes to fat blast-off!’ class:
Virgin Active’s Fast Classes are a gym-goer’s favourite. Performed on mats in the gym area rather than in a studio, they are perfect for those who find themselves short on time and needing to nip away before the end of a class. You can do just a few minutes or stay for the full 15-20 minutes. One of the sessions is UGI, which is made up of a series of one-minute exercises and combines strength, cardio and core training. The instructor-led movements revolve around a 15-inch squishy stress ball, which can be stood on, knelt on, or usedaspartofaplankorevenasa weight. Another class is Puma HIIT – a series of fat-burning drills focusing on speed and agility (virginactive.co.uk).5. Boost your metabolism in 20 seconds:
‘Perform 5 squats with shoulder presses, followed by 10 fast ladder climbs (where you pretend to climb a ladder lying on your front) on the floor. This exercise uses the large muscle groups, which increase muscle mass and EPOC (Excess Post-Exercise Oxygen Consumption) and, in turn, boosts your metabolic rate,’ says Giuseppe Minetti, founder of The Token Yard Club and an expert in metabolic fitness (thetokenyardclub.com).6. The anywhere APP/android workout:
Couldn’t make it to the gym this morning? That once-plausible excuse no longer cuts it thanks to apps like DailyBurn. Here, you can choose from and download hundreds of short workouts, and up to a month’s worth of fitness plans that can be performed anywhere – not just in your living room. Stream it while at the gym for a futuristic personal training experience (dailyburn.com).7. You(tube) can do it!:
Admittedly, we’ve mainly been YouTube-ing the John Lewis Christmas advert on repeat, but there’s an influx of high-quality HIIT workout videos on the video-sharing site too. The Nike Women channel boasts real-time interval and high-intensity virtual classes that hit the right note between encouraging and no-nonsense. Check them out at youtube.com/user/NikeWomen.Copied from : http://sg.news.yahoo.com/fit-4-minutes-exercise-let-introduce-new-hiit-143245007.html
Subscribe to:
Posts (Atom)