Skip to content

Instantly share code, notes, and snippets.

View Youngv's full-sized avatar

Victor Yang Youngv

View GitHub Profile

Git配置

git config --global user.name "robbin"   
git config --global user.email "fankai@gmail.com"
git config --global color.ui true
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global core.editor "mate -w"    # 设置Editor使用textmate

git config -l # 列举所有配置

@Youngv
Youngv / auto-login.rb
Last active December 28, 2015 07:09
这是一个实现在命令行登录和注销校园网的小脚本。
# encoding = utf-8
require 'mechanize'
class Internet
# 定义自动登录的地址
@@url = 'http://192.168.31.4:8080'
#初始化,生成一个Mechanize对象
def initialize
@agent = Mechanize.new
end
@Youngv
Youngv / hide_secret_in_jpg.rb
Created November 15, 2013 14:59
这是一个在JPG图片中隐藏Zip压缩文件的脚本。
#!/usr/bin/env ruby
require 'rubygems'
require 'zip'
class HideSecretInJpg
def file_to_zip(filename)
floder = File.expand_path(File.dirname(filename))
zipfile = File.basename(filename, ".*") + ".zip"
#zipfile = filename.sub(/\.\w+$/,"") + ".zip"
input_filenames = [filename]
@Youngv
Youngv / dianping.rb
Last active August 29, 2015 14:10
抓取点评数据的脚本。
#encoding: utf-8
require 'uri'
require 'json'
require 'base64'
PAGE_URL = "http://www.dianping.com/shop/"
AK = "2ozNcQ4RfFDlSQozwNBwKnIz"
PI = 3.14159265358979324 * 3000.0 / 180.0
def crawl_page(i,j)
@Youngv
Youngv / wgs84.rb
Created November 28, 2014 07:43
图吧坐标转WGS84坐标
def transform_coordinate
begin
wgLon,wgLat = mapBar2WGS84(self.lon,self.lat)
gdlat,gdlon = transform(wgLat, wgLon)
self.lat,self.lon = gdlat.round(6),gdlon.round(6)
self.coordinate_updated = 1
self.save
rescue => e
Rails.logger.error e
@Youngv
Youngv / ftp_upload_to_upyun.rb
Created July 21, 2015 03:37
通过FTP的方式把本地的图片上传到又拍云的脚本。
#!/usr/bin/ruby
# encoding: utf-8
require 'uri'
require 'net/ftp'
def send_to_ftp(sourcefile, host, username, password)
uri = URI.parse("ftp://" + host)
ftp = Net::FTP.new
ftp.connect(uri.host, uri.port)
@Youngv
Youngv / zhihu.js
Created September 13, 2017 09:37
屏蔽知乎网页版首页中夹杂的广告
// ==UserScript==
// @name 屏蔽知乎网页版首页中夹杂的广告
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 屏蔽知乎网页版首页中夹杂的广告
// @author Victor Young
// @match https://*.zhihu.com/*
// @grant none
// ==/UserScript==
@Youngv
Youngv / pubg_server_ips.rb
Created June 22, 2018 09:42
生成 PUBG 的专属 OpenVPN 配置
require 'json'
require 'netaddr'
require 'open-uri'
require 'nokogiri'
# azure香港 azure首尔
# aws釜山 aws首尔 aws东京
file = open('https://ip-ranges.amazonaws.com/ip-ranges.json') { |f| f.read }
data = JSON.parse(file)
@Youngv
Youngv / gist:b5bc3199fc0a5ff0814a070ad38a6755
Created September 30, 2018 09:16 — forked from cowboyrushforth/gist:5963752
Java<->Ruby AES-256-CBC PKCS5 Working 2 way encryption
# RUBY
require 'openssl'
require 'digest/sha2'
require 'json'
def bin2hex(str)
str.unpack('C*').map{ |b| "%02X" % b }.join('')
end
@Youngv
Youngv / pubg.lua
Created December 6, 2018 14:09
PUBG LGS
--------------------------------------------------------------------------
---------------- 基本设定 ------------------------------
--------------------------------------------------------------------------
---- 键绑定 ----
local ump9_key = nil
local akm_key = nil
local m16a4_key = nil
local m416_key = nil
local scarl_key = nil