Skip to content

Instantly share code, notes, and snippets.

View dgeibi's full-sized avatar
🤒
Out sick

Jiabin Peng dgeibi

🤒
Out sick
View GitHub Profile
class Class {
w(config) {
config = arguments[1]; config.url = arguments[0]; console.log(arguments[1],arguments[0]);
}
}
new Class().w('xxx', {})
function fn(config) { config = arguments[1]; config.url = arguments[0]; console.log(arguments[1],arguments[0]); }
fn('xxx', {})
const fs = require('fs');
const lock = require('./package-lock');
function fixDeps(dependencies) {
Object.keys(dependencies).forEach(key => {
const dep = dependencies[key];
const names = key.split('/');
const name = names[names.length - 1];
if (
dep.resolved &&
/*
DO NOT USE THIS POLYFILL
because `instanceof` operator won't work
copy from
https://github.com/paulmillr/es6-shim
https://github.com/wesleytodd/setprototypeof
https://github.com/zloirock/core-js
*/
Object.setPrototypeOf =
@dgeibi
dgeibi / async.js
Created November 26, 2017 08:26
async promise timer
async function async1() {
console.log('async 1')
await async2()
await async3()
console.log('async 1-1')
}
async function async2() {
console.log('async 2')
}
@dgeibi
dgeibi / normal.js
Last active May 1, 2024 21:16
[ES6 Class]
class Point {
set X(v) {
this.x = v;
}
get X() {
return this.x;
}
getX() {
console.log(this.X);
}
ipset -N gfwlist iphash
#Telegram
ipset add gfwlist 91.108.56.0/22
ipset add gfwlist 91.108.4.0/22
ipset add gfwlist 109.239.140.0/24
ipset add gfwlist 149.154.160.0/20
#iptables
iptables -t nat -A prerouting_lan_rule -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-port 1080
[Unit]
Description=Aria2 Service
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/aria2c --conf-path=%h/.config/aria2/aria2.daemon
[Install]
WantedBy=default.target
function listProperties(obj, objStr, option){
var getPropertyNames = function(obj){
var keys = [];
for(var key in obj){
keys.push(key);
}
return keys;
};
var func = getPropertyNames;
@dgeibi
dgeibi / genwhite-list.cmd
Last active February 6, 2016 15:10
dnsmasq-china-list --> Pcap_DNSProxy WhiteList.txt
@echo off
(
echo [Local Hosts]
echo ## China mainland domains
echo ## Sources: https://github.com/felixonmars/dnsmasq-china-list
echo.
) > "WhiteList.txt"
Tools\Routing_Update\bin\curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf