Skip to content

Instantly share code, notes, and snippets.

View liruqi's full-sized avatar

Ruqi liruqi

View GitHub Profile
@liruqi
liruqi / random_multi_select.py
Last active August 1, 2017 04:14
随机抽奖
import random
random.sample(range(1,201), 20)
@liruqi
liruqi / shadowsocks.cs
Last active June 1, 2017 09:03
shadowsocks uri
public static readonly Regex
UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase),
DetailsParser = new Regex(@"^((?<method>.+?):(?<password>.*)@(?<hostname>.+?):(?<port>\d+?))$", RegexOptions.IgnoreCase);
@liruqi
liruqi / gist:c0d15fa2950864b61282700063278a9c
Created March 7, 2017 12:12 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@liruqi
liruqi / block_aliyun.conf
Last active October 2, 2020 14:51
Block aliyun
/*
* https://myip.ms/view/ip_owners/179248/Aliyun_Computing_Co_Ltd.html
res = ""; for (i=0; i<41; i++) { console.log(arr[i].text); res = res + "\n" + arr[i].text; }
arr = $("table .JColResizer .row_name a")
101.132.0.0 - 101.133.255.255
101.200.0.0 - 101.201.255.255
101.37.0.0 - 101.37.255.255
106.14.0.0 - 106.15.255.255
/*
249 / 282 test cases passed.
Status: Wrong Answer
Input:
[-2,0,5,-1,-5,5,3]
-2
Output:
[[-5,-2,0,5],[-2,-1,0,1]]
Expected:
ALTER TABLE beijing_house add column `usage` varchar(16) default NULL;
ALTER TABLE `beijing_house` add column `createtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
== iOS ==
===Build guide===
* https://github.com/actorapp/actor-bootstrap/tree/master/docs/server
== Configuration ==
===File Storage===
AWS S3 or file system on actor server
* AWS S3: https://github.com/actorapp/actor-bootstrap/blob/master/docs/server/configure-s3.md
* Steps: [http://roomchat-cn.azurewebsites.net/oss/actor/aws-s3-cors1.jpg],[http://roomchat-cn.azurewebsites.net/oss/actor/aws-s3-cors2.jpg]
@liruqi
liruqi / NSPZeroMarginCell.m
Last active February 23, 2016 21:55
Zero content margin UITableViewCell
// Hide separator for specific cell is extremely hard in iOS 9.
// None of these worked or good enough for me:
// http://stackoverflow.com/questions/8561774/hide-separator-line-on-one-uitableviewcell
@interface NSPZeroMarginCell : UITableViewCell
@property (nonatomic, assign) BOOL separatorHidden;
@end
@liruqi
liruqi / center2views.m
Created January 20, 2016 07:24
Put to adjacent view in the horizontal middle of screen
// No working anyway
CGSize screenSz = [UIScreen mainScreen].bounds.size;
CGSize leftSz = [self.haveAccountLabel intrinsicContentSize];
CGSize rightSz = [self.signInButton intrinsicContentSize];
CGFloat contentWidth = leftSz.width + rightSz.width + 8;
CGFloat x = (screenSz.width - contentWidth) / 2;
if (x < 0) {
NSLog(@"Text overflow %lf > %lf", contentWidth, screenSz.width);
@liruqi
liruqi / facebook_email.js
Last active December 26, 2019 10:04
Get facebook fans email
var run = 0;
var mails = {}
total = 3000; //滚动次数,可以自己根据情况定义
function getEmails (cont) {
var friendbutton=cont.getElementsByClassName("_ohe");
for(var i=0; i<friendbutton.length; i++) {
var link = friendbutton[i].getAttribute("href");
if(link && link.substr(0,25)=="https://www.facebook.com/") {