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
def solution(s): | |
n = len(s) | |
ans = 999 | |
for i in range(n - 1): | |
q = set([s[i]]) | |
for j in range(i + 1, n): | |
q.add(s[j]) | |
#print(i, j , q, len(q)) |
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 | |
d="2020-01-01" | |
until [[ $d > 2020-05-01 ]]; do | |
p=`echo $d | sed -e 's/-//g'` | |
/home/work/php7.3.2/bin/php /path/to/project/artisan generate:report Log1 "$p" | |
/home/work/php7.3.2/bin/php /path/to/project/artisan generate:report Log2 "$p" | |
/home/work/php7.3.2/bin/php /path/to/project/artisan generate:report Log3 "$p" | |
d=$(date -I -d "$d + 1 day") | |
done |
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
// | |
// @reference https://faithandbrave.hateblo.jp/entry/20100318/1268896477 | |
// @memo | |
// on CentOS: | |
// yum install libicu libicu-devel | |
// g++ -std=c++14 -o cvt convert.cpp `pkg-config --libs --cflags icu-uc icu-io` | |
// | |
#include <iostream> | |
#include <vector> |
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
yum update | |
yum install epel-release | |
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm | |
yum install --enablerepo=remi,remi-php72 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt php-zip | |
yum install wget vim | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
compopt | |
ln -s /usr/local/bin/composer /usr/bin/ |
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
# list all apps | |
adb shell pm list packages -f | |
# install apk | |
adb install -r -t XXX.apk | |
# uninstall apk | |
adb uninstall com.thk.test_app | |
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
// find in a date range, which column is Number() Type. | |
db.collection.find({ | |
created_at: { | |
$gte: (new Date(2019, 5, 1)).getTime()/1000, // from 2019-06-01 | |
$lte: (new Date(2019, 5, 2)).getTime()/1000 // to 2019-06-02 | |
} | |
}) | |
// find by some field and count to result | |
DBQuery.shellBatchSize = 10000 |
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
from struct import * | |
import os | |
for subdir, dirs, files in os.walk('./'): | |
for file in files: | |
filepath = subdir + os.sep + file | |
if file == '_1.py': | |
continue | |
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
package main | |
import ( | |
"encoding/base64" | |
"encoding/hex" | |
"fmt" | |
"strings" | |
) | |
func Hex2bin(s string) []byte { |
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
cd /tmp | |
wget https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | |
chmod +x install-redhat-td-agent3.sh | |
./install-redhat-td-agent3.sh | |
chkconfig td-agent on | |
service td-agent start | |
## install plugin |
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
### install td-agent | |
wget https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | |
chmod +x install-redhat-td-agent3.sh | |
./install-redhat-td-agent3.sh | |
chkconfig td-agent on | |
/usr/sbin/td-agent-gem install fluent-plugin-ua-parser | |
service td-agent start | |