Skip to content

Instantly share code, notes, and snippets.

View ETiV's full-sized avatar
🛥️
船迟又遇打头风

ETiV

🛥️
船迟又遇打头风
  • Shanghai, China
  • 11:27 (UTC +08:00)
View GitHub Profile
@ETiV
ETiV / gitlab-oauth.patch
Created October 8, 2019 11:10
解决 GitLab 使用第三方 SSO OAuth 登录后,external user 不符合后台配置的问题
--- user.rb 2019-10-08 18:55:14.014163674 +0800
+++ user-patched.rb 2019-10-08 19:04:01.748236038 +0800
@@ -48,7 +48,7 @@
gl_user.block if block_after_save
- log.info "(#{provider}) saving user #{auth_hash.email} from login with admin => #{gl_user.admin}, extern_uid => #{auth_hash.uid}"
+ log.info "(#{provider}) saving user #{auth_hash.email} from login with admin => #{gl_user.admin}, extern_uid => #{auth_hash.uid}, primary email => #{gl_user.email}, user.external => #{gl_user.external}"
gl_user
rescue ActiveRecord::RecordInvalid => e
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MAKEJOBS=$(cat /proc/cpuinfo | grep processor | wc -l)
# fix PATH priority, better set in .bashrc / .zshrc
export PATH=/usr/local/bin:$PATH
sudo yum update && \
sudo yum groupinstall -y "Development Tools" && \
@ETiV
ETiV / README.md
Last active March 11, 2017 09:30
Nintendo Switch Hijack with Surge Mac

Nintendo Switch Hijack with Surge Mac

# Surge configuration file

[Host]
# DNS Hijack
conntest.nintendowifi.net = 10.0.0.1
# the IP address which you want to display the bootstrap page.

[Rule]
@ETiV
ETiV / iptables.sh
Last active December 24, 2018 22:53
setup iptables
#! /bin/bash
#DYNAMIC_IP=""
set -e
# Set the default policies to allow everything while we set up new rules.
# Prevents cutting yourself off when running from remote SSH.
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
@ETiV
ETiV / zimuzu-auto-sign.js
Created September 2, 2015 09:56
ZiMuZu.tv auto-dosign script in javascript. (NodeJS)
// First, setup username and password.
// Second, run command `npm link request` to install the depends
// Then, setup cronjob for auto checkin everyday.
var USERNAME = '_FILL_ME_';
var PASSWORD = '_FILL_ME_';
var request = require('request');
request = request.defaults({
jar: true
@ETiV
ETiV / Direct_Links_in_Google_Search.user.js
Last active August 29, 2015 14:25 — forked from astanin/Direct_Links_in_Google_Search.user.js
Remove indirections from Google search results on all TLDs (GreaseMonkey script)
function parseQueryString(qs) {
qs = qs.replace(/\+/g, ' ');
var params = {}, tokens,
re = /[?&]:?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
// console.log(tokens);
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
@ETiV
ETiV / osx-setup.sh
Last active March 12, 2021 08:24
osx initial sciprts
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@ETiV
ETiV / Install.nginx.sh
Last active August 29, 2015 13:59
快速创建服务器环境, 使用 sudo 执行
# nginx version 1.6.0
# http://nginx.org/download/nginx-1.6.0.tar.gz
# Install GD Library, GeoIP, SSL-dev
# apt-get install -y libgd2-xpm-dev libgeoip-dev libssl-dev
./configure --prefix=/srv/nginx --user=www --group=www --with-poll_module --with-file-aio --with-http_ssl_module --with-http_spdy_module --with-http_realip_module \
--with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_flv_module \
--with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module \
--with-http_secure_link_module --with-mail --with-pcre
@ETiV
ETiV / kill-test-sender.js
Created April 8, 2014 18:14
测试 NodeJS 支持的 kill signals
/**
* Created by ETiV on 4/9/14.
*/
var target_pid = 26263;
var signals = ['SIGHUP',
'SIGINT',
'SIGQUIT',
'SIGILL',