View delete_action_runs.py
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
import asyncio | |
import sys | |
from aiohttp import ClientSession, ClientTimeout | |
def seq_iter(seq, step=10): | |
if not seq: | |
return seq | |
from_idx, to_idx, seq_len = 0, step, len(seq) |
View rm duplicate items.py
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
a_list = [ | |
{"型号": 12, "重量": 16, "产地": 19, "审核人": 33}, | |
{"型号": 22, "重量": 92, "产地": 87, "审核人": 34}, | |
{"型号": 15, "重量": 27, "产地": 86, "审核人": 35}, | |
{"型号": 71, "重量": 55, "产地": 21, "审核人": 36}, | |
] | |
b_list = [ | |
{"产地": 87, "型号": 22, "重量": 92, "审核人": 34}, | |
{"产地": 86, "型号": 15, "重量": 27, "审核人": 35}, |
View upload_file_to_tmp_link.py
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 python3 | |
import http.client | |
import json | |
import mimetypes | |
import os | |
import random | |
import sys | |
from string import digits, ascii_letters | |
from urllib.parse import quote | |
from uuid import uuid4 |
View SimpleHTTPServerWithUpload.py
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 python3 | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
see: https://gist.github.com/UniIsland/3346170 | |
""" | |
View deseq2-analysis-template.R
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
## RNA-seq analysis with DESeq2 | |
## Stephen Turner, @genetics_blog | |
# RNA-seq data from GSE52202 | |
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=gse52202. All patients with | |
# ALS, 4 with C9 expansion ("exp"), 4 controls without expansion ("ctl") | |
# Import & pre-process ---------------------------------------------------- | |
# Import data from featureCounts |
View ip_mask.py
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
import sys | |
def main(fp): | |
print('ip\tmask') | |
with open(fp, 'r') as fh: | |
for line in fh: | |
line_trim = line.strip() | |
if line_trim.startswith('ip address'): | |
lst = line_trim.split() |
View code_highlight_addon.py
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
# -*- coding: utf-8 -*- | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
import codecs | |
import os | |
import sys | |
from aqt import editor, addons, mw |
View kk_change_ip.sh
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
#!/bin/sh | |
PATH=/usr/bin:/sbin:/bin | |
SW_FILE=/www/switches.json | |
NOW_IP=$(ifconfig wlan0 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) | |
OLD_IP=$(jq -r '.switches[0].ip' ${SW_FILE}) | |
if [ ${NOW_IP} != ${OLD_IP} ]; then | |
echo "ip changes detected, I'll update the ${SW_FILE}" | |
jq --arg v ${NOW_IP} '.switches[0].ip=$v' ${SW_FILE} > /tmp/tmp.json |
View color_msg.sh
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
#!/bin/bash | |
color_msg() { | |
if [ $# -gt 2 ]; then | |
echo -e "\033[1;31mUsage: ${0} [error|-e|info|-i|warn|-w] "your message".\033[0m" | |
fi | |
now_time=$(date '+[%Y/%m/%d %H:%M:%S]') | |
case ${1} in | |
# red | |
error|-e ) | |
echo -e "${now_time}\t\033[1;31m${2}\033[0m" |
View gist:71179b2e90e48d2a022da5dbef5e1199
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/python | |
import subprocess | |
import socket | |
import sys | |
def encode_packet(data): | |
output = bytearray() | |
for i in range(0, len(data)): |
NewerOlder