This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
wsl -d Ubuntu-20.04 -u root ip addr del $(ip addr show eth0 ^| grep 'inet\b' ^| awk '{print $2}' ^| head -n 1) dev eth0 | |
wsl -d Ubuntu-20.04 -u root ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0 | |
wsl -d Ubuntu-20.04 -u root ip route add 0.0.0.0/0 via 192.168.50.1 dev eth0 | |
wsl -d Ubuntu-20.04 -u root echo nameserver 192.168.50.1 ^> /etc/resolv.conf | |
powershell -c "Get-NetAdapter 'vEthernet (WSL)' | Get-NetIPAddress | Remove-NetIPAddress -Confirm:$False; New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (WSL)'; Get-NetNat | ? Name -Eq WSLNat | Remove-NetNat -Confirm:$False; New-NetNat -Name WSLNat -InternalIPInterfaceAddressPrefix 192.168.50.0/24;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------- | |
---------------- 基本设定 ------------------------------ | |
-------------------------------------------------------------------------- | |
---- 键绑定 ---- | |
local ump9_key = nil | |
local akm_key = nil | |
local m16a4_key = nil | |
local m416_key = nil | |
local scarl_key = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RUBY | |
require 'openssl' | |
require 'digest/sha2' | |
require 'json' | |
def bin2hex(str) | |
str.unpack('C*').map{ |b| "%02X" % b }.join('') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 屏蔽知乎网页版首页中夹杂的广告 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description 屏蔽知乎网页版首页中夹杂的广告 | |
// @author Victor Young | |
// @match https://*.zhihu.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding = utf-8 | |
require 'mechanize' | |
class Internet | |
# 定义自动登录的地址 | |
@@url = 'http://192.168.31.4:8080' | |
#初始化,生成一个Mechanize对象 | |
def initialize | |
@agent = Mechanize.new | |
end |
NewerOlder