Skip to content

Instantly share code, notes, and snippets.

View xuyuji9000's full-sized avatar

Karl Xu xuyuji9000

  • Shanghai, China
View GitHub Profile
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(100) NOT NULL
);
server {
listen 80;
server_name ssl2.yogiman.cn;
location /.well-known {
allow all;
}
location / {
return 301 https://$server_name$request_uri;
#!/bin/bash
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot -y
@xuyuji9000
xuyuji9000 / letsencrypt_2017.md
Created September 27, 2017 14:39 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

#!/bin/bash
sudo curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
#!/bin/bash
cd ~
git clone https://github.com/xuyuji9000/dotfile.git .dotfile
source ~/.dotfile/setup.sh
vim
@xuyuji9000
xuyuji9000 / mysql-full-backup.sh
Last active August 11, 2017 08:14
Make a full backup of a specific database in mysql
#!/bin/bash
DATABASE="forward"
mysqldump -u mysqlusernamehere -pmysqlpasswordhere $DATABASE > /mnt/mysql/full/$(date +"%d-%b-%Y")_$(echo $DATABASE).sql
@xuyuji9000
xuyuji9000 / remove-expired-files.sh
Last active August 11, 2017 11:06
Remove files with modification time more than 30 days ago.
#!/bin/bash
find ./ -mindepth 1 -mtime +30 -exec rm '{}' \;
#!/bin/bash
# install docker
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
@xuyuji9000
xuyuji9000 / ubuntu-1604-install-redis.sh
Created August 10, 2017 03:43
Install Redis on Ubuntu 16.04 LTS
#!/bin/bash
sudo apt-get update
sudo apt-get install redis-server