Skip to content

Instantly share code, notes, and snippets.

View songouyang's full-sized avatar
🎯
Focusing

songouyang

🎯
Focusing
View GitHub Profile
@songouyang
songouyang / csim.c
Last active December 20, 2018 05:54
csapp cache lab
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include "cachelab.h"
typedef struct arguments {
int h;
int v;
int s;
@songouyang
songouyang / init.md
Last active November 24, 2018 11:33
init
@songouyang
songouyang / a.csv
Created October 22, 2018 09:53
a.csv
City_ID City_EN City_CN Country_code Country_EN Country_CN Province_EN Province_CN Admin_ district_EN Admin_ district_CN Latitude Longitude AD_code
CN101010100 beijing 北京 CN China 中国 beijing 北京 beijing 北京 39.904987 116.40529 110100,110000,100000
CN101010200 haidian 海淀 CN China 中国 beijing 北京 beijing 北京 39.956074 116.31032 110108
CN101010300 chaoyang 朝阳 CN China 中国 beijing 北京 beijing 北京 39.92149 116.48641 110105
CN101010400 shunyi 顺义 CN China 中国 beijing 北京 beijing 北京 40.128937 116.65353 110113
CN101010500 huairou 怀柔 CN China 中国 beijing 北京 beijing 北京 40.324272 116.63712 110116
CN101010600 tongzhou 通州 CN China 中国 beijing 北京 beijing 北京 39.902485 116.6586 110112
CN101010700 changping 昌平 CN China 中国 beijing 北京 beijing 北京 40.218086 116.23591 110114
CN101010800 yanqing 延庆 CN China 中国 beijing 北京 beijing 北京 40.465324 115.98501 110119
CN101010900 fengtai 丰台 CN China 中国 beijing 北京 beijing 北京 39.863644 116.286964 110106
@songouyang
songouyang / font.sh
Created August 18, 2018 12:52
iterm2安装 SF Mono 字体
cd /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/
cp *.otf ~/Library/Fonts/
@songouyang
songouyang / python_setup.sh
Last active August 9, 2018 16:45
my setup
conda install flake8
@songouyang
songouyang / leetcode.cpp
Last active May 20, 2018 20:20
leetcode.cpp
static const auto _____ = []() {
// toggle off cout & cin, instead, use printf & scanf
ios::sync_with_stdio(false);
// untie cin & cout
cin.tie(nullptr);
return nullptr;
}();
static int x=[](){
std::ios::sync_with_stdio(false);
@songouyang
songouyang / thunder.sh
Last active March 17, 2021 04:39
删除 Mac 版迅雷垃圾组件
#!/bin/bash
cd /Applications/Thunder.app/Contents
echo "Removing XLPlayer..."
rm -rf Bundles/XLPlayer.app
echo "Removing unnecessary plugins..."
cd PlugIns/
sudo rm -rf advertising.xlplugin featuredpage.xlplugin iOSThunder.xlplugin liveupdate.xlplugin lixianspace.xlplugin myvip.xlplugin softmanager.xlplugin viprenew.xlplugin viptask.xlplugin viptips.xlplugin xiazaibao.xlplugin xlplayer.xlplugin activitycenter.xlplugin bbassistant.xlplugin livestream.xlplugin
sudo rm -rf webgame.xlplugin onethingcloud.xlplugin thunderword.xlplugin
echo "Disable autoupdate..."
sudo bash -c "echo '127.0.0.1 http://liveupdate.mac.sandai.net' >> /etc/hosts"
@songouyang
songouyang / main.cpp
Created March 25, 2018 05:37
编程珠玑第 1 章
#include <iostream>
#include <random>
#include <sys/time.h>
#include <vector>
#include <set>
#define BITSPERWORD 32
#define SHIFT 5
#define MASK 0x1F
#define N 10000000
@songouyang
songouyang / ran.py
Created March 24, 2018 15:30
等概率抽样
import random
def get_ran(m, n):
for i in range(n):
if(random.randint(0, n-i-1) < m):
print(i, end="")
m -= 1
print()
if __name__ == "__main__":