Skip to content

Instantly share code, notes, and snippets.

View Yxnt's full-sized avatar
💭
I may be slow to respond.

Yxnt Yxnt

💭
I may be slow to respond.
View GitHub Profile
@Yxnt
Yxnt / Readme.md
Last active February 4, 2020 13:12
Aliyun STS Signature
@Yxnt
Yxnt / pcstyle-keyboard.json
Created December 9, 2019 03:52
karabiner pc键盘映射
{
"title": "PC-Style Modifiers",
"rules": [
{
"description": "其他功能键",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home",
@Yxnt
Yxnt / agent.sh
Last active November 7, 2018 15:09
openfalcon bash agent centos5
#!/bin/bash
# Falcon Agent Bash
# https://www.cnblogs.com/pycode/p/6721373.html
endpoint="$hostname"
timestamp=`date +%s`
interval=30
transfer="$gateway"
@Yxnt
Yxnt / Spider.py
Last active April 18, 2018 06:15
简易爬虫基类
import requests
import redis
import json
from bs4 import BeautifulSoup
from requests import request
from config.config import Config
pool = redis.ConnectionPool(host=Config.redis_host, port=Config.redis_port, db=Config.redis_db,
password=Config.redis_pass)
@Yxnt
Yxnt / signature.py
Last active August 1, 2018 02:28
Aliyun Signature Python
import base64
import hmac
import time
from hashlib import sha1
from urllib.parse import quote
import random
class Sign(object):
FORMAT_ISO_8601 = "%Y-%m-%dT%H:%M:%SZ"
@Yxnt
Yxnt / cross_domain.lua
Last active December 11, 2017 05:20
多域名跨域处理
local function set_cross_domain_name()
local domain = "xxx.com" -- replace this
local domain_reg = string.format(".*%s",domain)
local schema = ngx.var.scheme -- get schema
local server_name = ngx.var.server_name -- get request header server name
local origin_name = ngx.req.get_headers()['Origin'] -- get request header Origin value
local m_server,err = ngx.re.match(server_name,domain_reg,"iu") -- match domain value from request server name
if origin_name then
local m_origin,err = ngx.re.match(origin_name,domain_reg,"iu") -- match domain value from request Origin
if m_origin then