This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
IS_PYTHON2 = sys.version_info[0] == 2 | |
if IS_PYTHON2: | |
print 'Hello, version 2' | |
else: | |
print 'Hello, version 3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change color | |
$("#judge").css("color", "red"); | |
# change text | |
$("#judge").text("right"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check cron status | |
(centos) | |
/etc/init.d/crond status | |
(ubuntu) | |
/etc/init.d/cron status | |
sudo service cron status | |
# edit own cron setting | |
crontab -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add remote repository to local git | |
git remote add origin {remote repository url} | |
// pushes up the all repository | |
git push -u origin --all | |
// pushes up any tags | |
git push -u origin --tags | |
// cancel one before commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get domain name(based on the request from the client.) | |
$_SERVER['HTTP_HOST']; | |
// move page | |
header('Location: {dest_url}'); | |
// execute phpunit | |
phpunit --colors {file_name | directory_name} | |
// get own file path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// connect remote server with ssh | |
ssh -p {port_number} {host_name(ip_address)} | |
// find file by last modified date(older than 30days ago). | |
find {target_directory} -mtime +30 | |
// delete found files by find command | |
find ./ -name "{file_name}" -exec rm -rf {} \; | |
// replace part of file name(a to b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CollectionMethods { | |
def main(args: Array[String]): Unit = { | |
val intList = List(1, 2, 3) | |
val intList2 = List(Set(1, 2), Set(3, 4), Set(5, 6)) | |
val strList = List("Pink", "Blue", "Yellow") | |
val mixList = List((1, "Pink"), (2, "Blue"), (3, "Yellow")) | |
// foreach | |
val listA = intList.foreach(f => f * 2) | |
println("listA= " + listA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// login to mysql | |
mysql -u {user_name} -p | |
// export database to dump | |
mysqldump --single-transaction -u {user_name} -p {database_name} > /tmp/{file_name}.dump | |
// import database from dump | |
mysql -u {user_name} -p {database_name} < /tmp/{file_name}.dump | |
// show databases |