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 | |
#set -e | |
#latest jar | |
jarFile=$(ls ./target/*.jar | sort -r | head -1) | |
echo "===========> Jar File $jarFile" | |
#check and kill process | |
UP=$(pgrep -f $jarFile | wc -l) | |
UP_PID=$(pgrep -f $jarFile) |
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 javax.crypto.Cipher; | |
import java.io.InputStream; | |
import java.security.*; | |
import java.util.Base64; | |
import static java.nio.charset.StandardCharsets.UTF_8; | |
public class RsaExample { | |
public static KeyPair generateKeyPair() throws Exception { | |
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA"); |
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
To sync the contents of dir1 to dir2 on the same system, type: | |
rsync -av --progress --delete dir1/ dir2 | |
-a, --archive | |
archive mode | |
--delete | |
delete extraneous files from dest dirs |
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 | |
UP=$(pgrep mysql | wc -l); | |
if [ "$UP" -ne 1 ]; | |
then | |
echo "MySQL is down."; | |
sudo service mysql start | |
else | |
echo "All is well."; | |
fi |
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 | |
location / { | |
set $mobile 0; | |
if ($http_user_agent ~* "iphone|android") { | |
set $mobile 1; | |
} | |
if ($mobile = 1) { | |
# return or rewrite to somewhere | |
} | |
} |
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 | |
#set -e | |
#to remove trailing \r character | |
#sed -i 's/\r$//' file_name.sh or using dos2unix to format: sudo yum install dos2unix -y | |
#https://trac.ffmpeg.org/wiki/CompilationGuide/Centos | |
#ffmpeg_version=3.2.1 | |
FFMPEG_HOME=/opt/ffmpeg | |
ffmpeg_version=snapshot | |
exec_time=$(date +"%Y%m%d%H%M%S"); | |
echo "===============> install required packages for ffmpeg $ffmpeg_version" |
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 | |
#set -e | |
#to remove trailing \r character | |
#sed -i 's/\r$//' file_name.sh or using dos2unix to format: sudo yum install dos2unix -y | |
#https://trac.ffmpeg.org/wiki/CompilationGuide/Centos | |
#https://abi-laboratory.pro/tracker/timeline/ffmpeg/ | |
FFMPEG_HOME=/opt/ffmpeg | |
FFMPEG_VERSION=3.3.6 | |
exec_time=$(date +"%Y%m%d%H%M%S"); | |
echo "=======================================> install required packages for ffmpeg $FFMPEG_VERSION" |
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
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide | |
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel | |
mkdir ~/ffmpeg_sources | |
cd ~/ffmpeg_sources | |
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz | |
tar xzvf yasm-1.2.0.tar.gz | |
cd yasm-1.2.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
## Configure eth0 | |
# | |
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
DEVICE="eth0" | |
NM_CONTROLLED="yes" | |
ONBOOT=yes | |
HWADDR=A4:BA:DB:37:F1:04 | |
TYPE=Ethernet | |
BOOTPROTO=static |
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 | |
## crontab: min hr mday month wday command | |
# 15 9 * * * /Users/[your user name]/scripts/auto_mysql_backup.sh | |
## Restore from Backup | |
# gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] | |
# or | |
# gunzip [backupfile.sql.gz] | |
# mysql -u [uname] -p[pass] [dbname] < [backupfile.sql] | |
HOSTNAME=localhost |