# Total hours [h]
# Hours & minutes [h]:mm
# Hours, minutes, seconds [h]:mm:ss
# Total minutes [m]
# Minutes & seconds [m]:ss
# Total seconds [s]
This file contains hidden or 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
| const scriptName = "kakao"; | |
| function response(room, msg, sender, isGroupChat, replier) { | |
| replier.reply("안녕하세요! 만쥬야입니다."); | |
| } |
This file contains hidden or 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
| // Names array (last name first, then first name) | |
| const names = [ | |
| { lastName: 'JO', firstName: '' }, | |
| { lastName: 'IM', firstName: '' }, | |
| { lastName: 'LEE', firstName: '' }, | |
| { lastName: 'LIM', firstName: '' }, | |
| { lastName: 'SUNG', firstName: '' }, | |
| { lastName: 'LIM', firstName: '' } | |
| ]; |
This file contains hidden or 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
| #!/bin/bash | |
| # Function to format numbers | |
| format_number() { | |
| if (( $1 >= 1000000000 )); then | |
| echo $(bc <<< "scale=1; $1/1000000000")B | |
| elif (( $1 >= 1000000 )); then | |
| echo $(bc <<< "scale=1; $1/1000000")M | |
| elif (( $1 >= 1000 )); then | |
| echo $(bc <<< "scale=1; $1/1000")K |
This file contains hidden or 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
| func GenUpsertQueryWithRecords(tablename string, cols []string, onConflictCols []string, updateCols []string, values [][]interface{}) string { | |
| // Create the ON CONFLICT clause based on the specified columns | |
| onConflict := "" | |
| if len(onConflictCols) > 0 { | |
| onConflict = fmt.Sprintf("ON CONFLICT (%s) DO UPDATE SET", strings.Join(onConflictCols, ", ")) | |
| } | |
| // Create the SET clause for the UPDATE part of the query | |
| setClause := "" | |
| if len(updateCols) > 0 { |
This file contains hidden or 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
| #!/bin/bash | |
| # Step 1: Get the content IDs and titles of the articles from the last 6 months in the project | |
| results=$(curl -u username:password -s "https://your-confluence-site/wiki/rest/api/content?limit=50&expand=history&spaceKey=XXX" -H "Content-Type: application/json" | jq --arg six_months_ago "$six_months_ago" -r '.results[] | {id, title}') | |
| # Step 2: Retrieve the likes for each content ID and print the details | |
| while IFS= read -r line; do | |
| content_id=$(jq -r '.id' <<< "$line") | |
| title=$(jq -r '.title' <<< "$line") | |
| likes=$(curl -u username:password -s "https://your-confluence-site/wiki/rest/api/content/${content_id}/likes" -H "Content-Type: application/json" | jq -r '.likes') |
This file contains hidden or 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
| # 1. dump of the Launch Services database | |
| # ref: https://stackoverflow.com/questions/29614303/list-of-url-scheme-mappings-for-apple-mac-and-or-iphone | |
| /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | |
| # 2. the alternative way | |
| # ref: https://superuser.com/questions/548119/how-do-i-configure-custom-url-handlers-on-os-x/548122#548122 |
This file contains hidden or 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
| cat << EOF > /tmp/sample.csv | |
| "one", | |
| "three | |
| four", | |
| "seven" | |
| EOF | |
| gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' /tmp/sample.csv | awk -F, '{print $1}' |
This file contains hidden or 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
| <?php | |
| // https://stackoverflow.com/questions/39086660/upgrading-phpunit-from-4-8-to-5-5 | |
| /** | |
| * Returns a mock object for the specified class. | |
| * | |
| * This method is a temporary solution to provide backward compatibility for tests that are still using the old | |
| * (4.8) getMock() method. | |
| * We should update the code and remove this method but for now this is good enough. | |
| * | |
| * |
This file contains hidden or 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
| <?php | |
| function encrypt_mcrypt($msg, $key, $iv = null) { | |
| $pad = 16 - (strlen($msg) % 16); | |
| $msg .= str_repeat(chr($pad), $pad); | |
| if (!$iv) { | |
| $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND); | |
| } | |
| $encryptedMessage = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $msg, MCRYPT_MODE_CBC, $iv); | |
| return base64_encode($iv . $encryptedMessage); | |
| } |
NewerOlder