Skip to content

Instantly share code, notes, and snippets.

pagewang pagewang0

Block or report user

Report or block pagewang0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pagewang0
pagewang0 / network-tweak.md
Created Dec 18, 2019 — forked from mustafaturan/network-tweak.md
Linux Network Tweak for 2 million web socket connections
View network-tweak.md

Sample config for 2 million web socket connection

    sysctl -w fs.file-max=12000500
    sysctl -w fs.nr_open=20000500
    # Set the maximum number of open file descriptors
    ulimit -n 20000000

    # Set the memory size for TCP with minimum, default and maximum thresholds 
    sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
View vs code
{
"workbench.iconTheme": "vs-minimal",
"workbench.colorTheme": "Monokai",
"files.trimTrailingWhitespace": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"eslint.autoFixOnSave": true,
"search.exclude": {
"node_modules": true,
"coverage": true,
View autogui.py
import pyautogui
def find():
for i in range(10):
pyautogui.moveTo(300, 300, duration=0.25)
pyautogui.moveTo(400, 300, duration=0.25)
pyautogui.moveTo(400, 400, duration=0.25)
pyautogui.moveTo(300, 400, duration=0.25)
find()
View groupby.js
// 成绩等级分为A、B和C三级
function getGrade(score) {
return score < 60 ? 'C' :
score < 80 ? 'B' : 'A';
};
// 学生及其成绩
let students = [
{ name: '张三', score: 84 },
{ name: '李四', score: 58 },
{ name: '王五', score: 99 },
View gist:26c69f171129e425f2401990b8bf3501
transform: {
sfjjr: 'stockbroker',
czdh: 'type'
}
const transform = (res) => {
if (_.isArray(res)) {
res.map(row => transform(row));
}
View gist:425466baa730f6e264a6
1
var str = 'bdca'
console.log(str.split(‘’).sort().join(‘’))
2
var index, res = []
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
var num = Math.floor(Math.random() * arr.length)
for(var i=num;i>=0;i--){
View gist:a9bad1cf5bbc5a909656
var assert = require('assert')
function Node(){
this.parent
this.data
this.next
this.index
}
function sort(a, index, p){
You can’t perform that action at this time.