Skip to content

Instantly share code, notes, and snippets.

@blueskyarea
blueskyarea / python-version.py
Created June 1, 2017 14:10
check for installed python version
#!/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'
# change color
$("#judge").css("color", "red");
# change text
$("#judge").text("right");
# 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
@blueskyarea
blueskyarea / git command
Last active April 19, 2021 16:15
git-command
// 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
@blueskyarea
blueskyarea / php-command.php
Last active August 29, 2015 14:27
php command
// 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
@blueskyarea
blueskyarea / linux-command.sh
Last active April 12, 2016 15:40
linux command
// 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)
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)
@blueskyarea
blueskyarea / mysql.sql
Last active August 31, 2015 14:01
mysql command
// 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
@blueskyarea
blueskyarea / disable_button.js
Last active August 29, 2015 14:01
javascript sample
// use jquery
$(".submit-button").click(function(){
if ($(this).hasClass("disabled")) return false;
$(this).addClass("disabled");
});
//$(this).attr("disabled", "disabled"); // Not move on GoogleChrome