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/sh | |
echo $1 | |
patt="^-?[0-9]+$" | |
if [[ "$1" =~ $patt ]] | |
then | |
echo "true" | |
else | |
echo "false" |
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
import smtplib | |
smtp = smtplib.SMTP('smtp.gmail.com', 587) | |
smtp.ehlo() | |
smtp.starttls() | |
smtp.login('login_account','login_password') | |
smtp.sendmail('no-reply@gmail.com', | |
'ting911111@gmail.com', | |
'Subject: Hello World Email!\n\nHi there~') | |
smtp.quit() |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
<servers> | |
<server> | |
<id>st-nexus</id> | |
<username>${ACCOUNT}</username> | |
<password>${PASSWORD}</password> | |
</server> |
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 | |
for proc in $(find /proc -maxdepth 1 -regex '/proc/[0-9]+'); do | |
printf "%2d %5d %s\n" \ | |
"$(cat $proc/oom_score)" \ | |
"$(basename $proc)" \ | |
"$(cat $proc/cmdline | tr '\0' ' ' | head -c 50)" | |
done 2>/dev/null | sort -nr | head -n 10 |
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 | |
// execute command: php insertion-sorting.php 5 0 2 --detail | |
echo 'selection sorting'.PHP_EOL; | |
$sort_array = array(); | |
for ($i = 1; $i <= count($argv); $i++){ | |
$value = $argv[$i]; | |
if (preg_match('/^(--)/', $value)) { | |
$value = substr($value, 2); | |
$$value = true; |
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 | |
// execute command: php selection-sorting.php 5 0 2 --detail | |
echo 'selection sorting'.PHP_EOL; | |
$sort_array = array(); | |
for ($i = 1; $i <= count($argv); $i++){ | |
$value = $argv[$i]; | |
if (preg_match('/^(--)/', $value)) { | |
$value = substr($value, 2); | |
$$value = true; |
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 | |
// execute command: php bubble-sorting.php 5 0 2 | |
echo 'bubble sorting'.PHP_EOL; | |
$sort_array = array(); | |
for ($i = 1; $i <= count($argv); $i++){ | |
$value = $argv[$i]; | |
if (preg_match('/^(--)/', $value)) { | |
$value = substr($value, 2); | |
$$value = true; |
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
#!/usr/bin/env python3 | |
from PIL import Image | |
import base64,io | |
scale = 0.3 | |
def tobase64(img): | |
return base64.b64encode(img).decode('ascii') | |
def imgResize(img, scale=1): |