Skip to content

Instantly share code, notes, and snippets.

@wgzhao
wgzhao / word_to_card.py
Created October 26, 2025 13:58
把单词列表转为单写默写卡
"""
单词默写表格生成小工具
读取包含了单词以及中文释义两列的 Excel 文件(也可以是 csv 文件)
然后按照 A4 纸大小排列可这翻折的单词默写表格形式
每页 48 个单词,每个单词都需要默写中文释义以及中文对应的单词
"""
import pandas as pd
import openpyxl
from openpyxl.styles import Alignment, Border, Side
from openpyxl.worksheet.page import PageMargins
@cloudwu
cloudwu / sortnumber.c
Created August 1, 2023 05:38
sort telephone number
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#define N (100000063/64)
struct bitset {
uint64_t bits[N];
@wgzhao
wgzhao / config_git_use_proxy.md
Created May 18, 2021 01:16
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@goldengrape
goldengrape / learnmusic.py
Created December 9, 2018 20:43
learnmusic.py
#! python2
# NOTE: The first line in this script specifies that it should always be run using Python 2.7.
# The `midiutil` module is currently not available for Python 3.
'''Generates a MIDI file with 12 random notes in C major, using the midiutil module. The instrument is also picked randomly. The result is then played with the sound.MIDIPlayer class.
If nothing happens, make sure that your device isn't muted.
'''
from midiutil.MidiFile import MIDIFile
@goldengrape
goldengrape / Face_Recognition_tinker.py
Created November 20, 2017 06:05
通过并联神经网络改进deeplearning.ai中人脸识别作业
# coding: utf-8
# # 持续训练
#
# 问题提出: 如果人脸识别在使用中发现准确率并不够高, 是否可以继续改进? 如何在已有的基础之上继续改进?
#
# 解决方法: 建立并联的判别神经网络, 将A人脸的128位编码和待测人脸的128位编码作为输入, 二值判别输出
# * 路径A: 计算二阶范数距离, 并以原题目中的阈值作为分界, 形成输出
# * 路径B: 待训练神经网络, 早期时参数值都很小, 因此输出值也很小, 但可被训练.
library(tidyverse)
library(gganimate)
NUMPLAYERS = 45
ROUNDS = 5000
INITWEALTH = 45
#initialize the bank
#columns wealths of the NUMPLAYERS players
#rows show wealths of each of the ROUNDS ticks of the clocks
@diyism
diyism / install TOR with meek.txt
Last active July 30, 2022 18:42
install TOR with meek
#thanks to:
https://www.torproject.org/docs/debian
http://askubuntu.com/questions/501496/how-to-install-tor-with-meek-support
https://plus.google.com/+GhostAssassin/posts/26zCmDmjYXP
#In /etc/apt/sources.list:
deb http://deb.torproject.org/torproject.org trusty main
deb-src http://deb.torproject.org/torproject.org trusty main
#Run:
sudo apt-get update
@jgamblin
jgamblin / Top10SC.py
Last active December 19, 2016 22:11
List Top 10 Vuln System With Details
#!/usr/bin/env python3
from securitycenter import SecurityCenter5
import subprocess
def vulns():
sc = SecurityCenter5('nessus')
sc.login('nessusapi', 'Afinepassword!')
response = sc.get('status')
hosts = sc.analysis(tool='sumip', page=0, page_size=10, sortDir='desc',sortField='score')
@diyism
diyism / dns2https.php
Last active July 26, 2021 13:42
dns2https.php
<?php
/*
udp/tcp dns client for google dns over https (https://dns.google.com)
ubuntu上使用:
在/etc/rc.local里加/usr/bin/php /home/<your_name>/dns2https.php
执行:
systemctl disable unbound
systemctl disable dnscrypt-proxy
@terrywang
terrywang / config
Last active October 13, 2022 20:39
Secure Enhanced ~/.ssh/config OpenSSH client per-user configuration file
# User ssh configuration file ~/.ssh/config
# Gist https://gist.github.com/terrywang/3997931
# man ssh_config for more information
# Inspired by the blog post below to fight the NSA
# https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Github needs diffie-hellman-group-exchange-sha1 some of the time but not always
# Host github.com
# KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1