Skip to content

Instantly share code, notes, and snippets.

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

ETiV

🛥️
船迟又遇打头风
  • Shanghai, China
  • 19:07 (UTC +08:00)
View GitHub Profile
@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 / CentOS-Install-gitlab_ci.sh
Last active March 11, 2021 15:28
Install gitlab-ci on CentOS. I've installed on CentOS 6.4 64bit.
#!/bin/sh
rpm -Uih https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
curl -L https://get.rvm.io | bash -s stable
rvm install 2.0.0
rvm use 2.0.0@global --default
# for chinese user, if you have a wonderful speed ignore this part
# to have a faster download speed
# switch gem source to ruby.taobao.org
@ETiV
ETiV / flags_of_iTunes.txt
Created August 27, 2013 03:40
iTunes Flags are so beautiful
Region => The United States and Canada
Canada => https://s.mzstatic.com/images/flags/-dsi-50/can.png
United States => https://s.mzstatic.com/images/flags/-dsi-50/usa.png
Region => Europe
Albania => https://s.mzstatic.com/images/flags/-dsi-50/alb.png
@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
@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
#!/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 / db-mysql.js
Last active May 19, 2016 17:18
Node.JS mysql 数据库快速访问
/**
* Created by ETiV on 10/24/14.
*/
var mysql = require('mysql')
, config = require('./config');
/**
* config =
* {
mysql: {
@ETiV
ETiV / QQYueTuan-SongList.json
Last active December 26, 2015 16:19
QQ乐团歌曲列表 / with keytype, 等级
[
{ idx: 1,
title: '上海之恋',
abbr: 'shanghaizhilian',
artist: '橘子焦糖',
offset: '0.098611',
bpm: '149',
'4k': { ez: 2, nm: 4, hd: 5 },
'5k': { ez: 2, nm: 4, hd: 6 } },
{ idx: 2,
@ETiV
ETiV / find_brother.js
Created September 11, 2013 09:04
给定一个数X,他的兄弟数Y定义为:是由X中的数字组合而成,并且Y是大于X的数中最小的。例如,38276的兄弟数字为38627。给定X,求Y。
var find_next_max = function (num) {
var _result = '', _arr = num.toString().split('');
// 从 _arr 里找到比 num 首位大的最小的数
// 因为 _arr 里的数字都是个位数, 所以返回 10 的话, 表示找不到
var find_number_larger_than_first_pos = function () {
var first, n = 10, _num;
for (var i in _arr) {
_num = parseInt(_arr[i]);
if (i == 0) {