This file contains 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
var cv = document.getElementById('cv'); | |
var c = cv.getContext('2d'); | |
var txtDiv = document.getElementById('txt'); | |
var fileBtn = document.getElementById("up-button"); | |
var img = new Image(); | |
img.src = 'a.jpg'; | |
img.onload = init; // 图片加载完开始转换 | |
fileBtn.onchange = getImg; | |
// 根据灰度生成相应字符 |
This file contains 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
# valid | |
aws cloudformation validate-template --template-body file://MyStack.json | |
# create stack | |
aws cloudformation create-stack --template-body file://Mystack.json --stack-name MyFirstStack | |
# create stack with parameter | |
aws cloudformation create-stack --template-body file://CloufFormationSample.json --stack-name MyFirstStack --parameters ParameterKey=KeyNameParameter,ParameterValue=HogeKeyPair | |
# update stack |
This file contains 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 usefull software | |
sudo yum install -y aws-cli gcc git emacs vim tmux screen htop iotop iptraf curl | |
# Install lib for build python | |
sudo yum install -y openssl openssl-devel zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel patch | |
# Change sysctl | |
sudo sed -i 's/fs.file-max.*//' /etc/sysctl.conf | |
sudo sh -c 'echo "fs.file-max = 65535" >> /etc/sysctl.conf' | |
sudo sed -i 's/net.core.somaxconn.*//' /etc/sysctl.conf |
This file contains 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 | |
# | |
# nginx - this script starts and stops the nginx daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# config: /etc/sysconfig/nginx |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
rpm -Uvh http://download.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm | |
yum -y install ppp pptpd | |
cp /etc/pptpd.conf /etc/pptpd.conf.bak | |
cat >/etc/pptpd.conf<<EOF | |
option /etc/ppp/options.pptpd | |
logwtmp | |
localip 10.0.10.1 | |
remoteip 10.0.10.2-254 | |
EOF |
This file contains 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 | |
# | |
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN server | |
# on a Ubuntu or Debian instance. Tested with Ubuntu 14.04 & 12.04 and Debian 8 & 7. | |
# With minor modifications, this script *can also be used* on dedicated servers | |
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers. | |
# | |
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN | |
# YOUR AMAZON EC2 INSTANCE STARTS! | |
# |
This file contains 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
# Basic Strongswan ikev2 server setup | |
* paltform: atlantic.net ubuntu 14.04 x64 | |
* the commands below are run with root account | |
## Strongswan | |
``` | |
apt-get install strongswan | |
apt-get install iptables iptables-persistent | |
``` |
This file contains 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/expect -f | |
set timeout -1 | |
if { ${argc} < 2 } { | |
send_user "Usage:\n" | |
send_user "\t${argv0} PASSWORD \[USER@\]HOST \[COMMAND1 \[; COMMAND2\] ...\]\n" | |
send_user "\n" | |
send_user "Default USER is current login\n" | |
send_user "Without any COMMAND, will get an interactive shell on the remote.\n" | |
send_user "With COMMAND(s), it will be run on the remote, and return the last command's status.\n" |
This file contains 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
sudo chown root:wheel /usr/local/bin/htop | |
sudo chmod u+s /usr/local/bin/htop |
OlderNewer