Skip to content

Instantly share code, notes, and snippets.

View michaelyin's full-sized avatar

michaely michaelyin

View GitHub Profile
@michaelyin
michaelyin / heap_memory.sh
Created April 24, 2018 14:33
find out memory usage in a jvm log
#!/bin/bash
grep 'heap memory' access.log | cut -f12,16 -d" " | awk '{if ($1 > 7500) {print $1, $2}}'
@michaelyin
michaelyin / count_exception.sh
Created April 24, 2018 04:53
script to get info. of all Exception in log file.
#!/bin/bash
for X in $(egrep -o "[A-Z]\w*Exception" access.log | sort | uniq);
do
echo -n -e "processing $X\t"
grep -c "$X" access.log
grep "$X" -m 1 -A 4 access.log
done
@michaelyin
michaelyin / uncompress files shell scripts
Created March 3, 2018 22:34
script to uncompress files in linux
#!/bin/bash
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar zxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
1. crop image
python scripts/preprocessing/preprocess_images.py --input-dir ../formula_images --output-dir ../images_processed
2. formula normalization
python scripts/preprocessing/preprocess_formulas.py --mode normalize --input-file ../im2latex_formulas.lst --output-file
formulas.norm.lst
3. generate lists
python scripts/preprocessing/preprocess_filter.py --filter --image-dir ../images_processed --label-path formulas.norm.lst
--data-path ../im2latex_train.lst --output-path train.lst
@michaelyin
michaelyin / logging.conf
Created September 9, 2017 15:35 — forked from wrunk/logging.conf
Getting setup with proper python logging
# ---------------------------------------------------------------------------- #
# Standard setup stuff. In general you will want to alter the formatters
#
[formatters]
keys: detailed,simple
[handlers]
keys: console
[formatter_simple]
@michaelyin
michaelyin / gist:0f8297479c9a9b4f1bb89b127459d780
Last active August 10, 2017 20:52
count all '1's from all integers starting from 1 to a upperbound
python code
@michaelyin
michaelyin / cut, awk example
Created June 20, 2017 13:35
a simple example illustrating usage of cut and awk
tail -f server.log | grep -a duration | cut -f2,13 –d” “ | awk ‘{if ($2 > 340) { print
$2}}’
@michaelyin
michaelyin / gist:4392f9a51af7c1173b9a1b7d69ca0922
Created April 11, 2017 15:16
Configure Spring Boot project in Eclipse
.classpath file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
.
.
If throwing an exception, I would choose one of these more descriptive classes:
AssertionError
IllegalStateException
In general, checked Exceptions are supposed to be recoverable, and therefor it is worthwhile catching them.
In this case, using an unchecked exception, I assume it should never occur during normal operation and probably
indicates an unrecoverable coding error.
{
"form": "JN3P8g",
"form_name": "会员注册",
"entry": {
"serial_number": 7,
"field_1": "xxx",
"field_2": "18712717072",
"x_field_weixin_nickname": "Bachelordom",
"x_field_weixin_gender": "男",
"x_field_weixin_country": "中国",