Skip to content

Instantly share code, notes, and snippets.

@kettanaito
kettanaito / README.md
Last active April 26, 2024 08:01
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@mariotaku
mariotaku / README.md
Last active December 18, 2020 05:01
Followers Cleaner Script

Usage

  1. Execute pip3 install -r requirements.txt to install dependencies
  2. Execute followers_clear.py and follow instructions.

Notes

Consumer keys can be found here. Use these keys instead of applying yourself can get rid of rate limit.

@soffchen
soffchen / surge.conf
Last active March 4, 2024 05:23
surge.conf
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom
@liruqi
liruqi / nginxhttpproxy.conf
Created November 22, 2014 15:29
nginx http proxy config
server {
listen 80;
server_name *.cn *.org *.com *.jp *.hk *.io *.info "";
client_body_timeout 60000;
client_max_body_size 1024m;
send_timeout 60000;
client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
@bao3
bao3 / cert-client.sh
Created October 6, 2014 08:31
这是几个用来签发证书的脚本,请注意这需要你安装了gnutls才可以,主要当时是为了ocserv而写,纯偷懒。基本上,你只要用 ./cert-client.sh you-user-name 这种格式,就可以自动生成 you-user-name-key.pem/ your-user-name-cert.pem /your-user-name.p12
#! /bin/sh
#! /usr/bin/expect -f
certtool --generate-privkey --outfile $1-key.pem
sed -i "1ccn = "${1}"" client.tmpl
sed -i "3cemail = ${1}@abc.org" client.tmpl
certtool --generate-certificate --load-privkey $1-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template client.tmpl --outfile $1-cert.pem
openssl pkcs12 -export -inkey $1-key.pem -in $1-cert.pem -name "$1 VPN Client Cert" -certfile ca-cert.pem -out $1.cert.p12
@fqrouter
fqrouter / readme.txt
Last active April 16, 2023 18:10
shadowsocks 公共代理的必要设置
good, 你已经有了一个自己的shadowsocks代理了,现在想要把这个代理公布出去给所有人分享。
但是没有两个小时,代理就没法使用了,为什么?因为你需要额外注意以下事项(以下步骤需要比较高的linux技能)
本文只关注于确保shadowsocks服务还“活着”,如果你希望让其跑得更快,请参考
https://github.com/clowwindy/shadowsocks/wiki/Optimizing-Shadowsocks
1、 shadowsocks的timeout设置
超时时间越长,连接被保持得也就越长,导致并发的tcp的连接数也就越多。对于公共代理,这个值应该调整得小一些。推荐60秒。
2、 检查操作系统的各种限制
对于openvz的vps,特别需要检查一下
@JacksonTian
JacksonTian / gbk.js
Created February 17, 2014 07:58
utf8 => gbk
var fs = require('fs');
var iconv = require('iconv-lite');
// 这里是utf8
var str = '坑爹啊,都是国际项目了,编码居然还用gbk';
console.log(new Buffer(str).length);
// 转换成gbk
var encoded = iconv.encode(str, 'gbk');
@ryokun6
ryokun6 / Gruntfile.js
Created October 10, 2013 02:42
Gruntfile template LiveReload with Takana
// Generated on 2013-10-08 using generator-angular 0.4.0
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
@stevenhaddox
stevenhaddox / server_certificates_to_pem.md
Last active December 14, 2023 05:42
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample