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
#!/usr/bin/env bash | |
# copy from: https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin | |
export PATH | |
#=================================================================# | |
# System Required: CentOS 6,7, Debian, Ubuntu # | |
# Description: One click Install ShadowsocksR Server # | |
# Author: Teddysun <[email protected]> # | |
# Thanks: @breakwa11 <https://twitter.com/breakwa11> # | |
# Intro: https://shadowsocks.be/9.html # |
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
const fs = require('fs'); | |
const path = require('path'); | |
const http = require('http'); | |
function createServer(videoRepoPath) { | |
return http.createServer((req, res) => { | |
if (/video\/.*\/view/gi.test(req.url)) { | |
console.log(req.url, req.url.split('/')); | |
const [, , video] = req.url.split('/'); | |
const ext = path.extname(video); |
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 { | |
Controller, | |
Get, | |
Response | |
} from '@nestjs/common'; | |
import {ImageService} from './image.service'; | |
export class GalleryController { | |
constructor(private readonly imageService: ImageService) { | |
} |
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 { | |
Controller, | |
Get, | |
ParseIntPipe, | |
Query, | |
} from '@nestjs/common'; | |
export class GalleryController { | |
constructor() { | |
} |
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
function escapeRegExp(text) { | |
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | |
} |
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
# create conversation | |
curl -X POST \ | |
-H "X-LC-Id: JeUOhVkPeBkCbfnRA3mWWe8j-gzGzoHsz" \ | |
-H "X-LC-Key: Sln8zi7RaBvwIvE1ka6DYWf2" \ | |
-H "Content-Type: application/json" \ | |
-d '{"name":"My Private Room","m": ["BillGates", "SteveJobs"]}' \ | |
https://jeuohvkp.api.lncld.net/1.2/rtm/conversations | |
# get conversation |
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. preparation | |
## 1.1 create cert-webroot | |
sudo mkdir /opt/sites/cert-webroot | |
cd /opt/sites/cert-webroot | |
## 1.2 create demo page | |
sudo touch index.html | |
sudo echo "<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="UTF-8">\n<title>Demo Site</title>\n</head>\n<body>\n<h1>This is a demo site</h1>\n</body>\n</html>" > index.html | |
## 1.3 update nginx default config | |
cd /etc/nginx/sites-enabled | |
vim default |
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
## sitename.com | |
server { | |
listen 80; | |
listen [::]:80; | |
# expires $expires; | |
server_name <site_name>; | |
location ^~ /.well-known/acme-challenge/ { |
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
## demo site | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name <site_name>; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl http2; |
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name <api_server_name>; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; |