This file contains hidden or 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
#include <iostream> | |
#include <sstream> | |
#include <fstream> | |
std::string readFileToStr(std::string file) | |
{ | |
std::ifstream input(file); | |
std::stringstream sstr; | |
while(input >> sstr.rdbuf()); |
This file contains hidden or 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
[Unit] | |
Description=Shadowsocks Python local client | |
[Service] | |
Type=forking | |
ExecStart=/path/to/sslocal -c /path/to/config.json -d start | |
ExecReload=/path/to/sslocal -c /path/to/config.json -d restart | |
ExecStop=/path/to/sslocal -c /path/to/config.json -d stop | |
[Install] |
This file contains hidden or 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 smtplib | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
from_addr = "[email protected]" | |
to_addr = "[email protected]" | |
msg = MIMEMultipart() | |
msg['From'] = from_addr | |
msg['To'] = to_addr |
This file contains hidden or 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
#include <windows.h> | |
#include <stdio.h> | |
void normal(char* s) { | |
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); | |
WORD info_style = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; | |
SetConsoleTextAttribute(hOut, info_style); | |
printf(s); | |
} |
This file contains hidden or 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
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\Standard | |
\HKEY_CURRENT_USER\Control Panel\Colors |
This file contains hidden or 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 requests | |
from bs4 import BeautifulSoup | |
base_url = 'https://zzk.cnblogs.com/s/blogpost' | |
cookies = dict( | |
ZzkNoRobotCookie= | |
'CfDJ8KlpyPucjmhMuZTmH8oiYTOsZWLqcxSx0sRuNdfc35P334ttmwTqPekgb1OOGtp_JeXby7PZgQla4HC63Y3_nnWwF8kvdklA71DbLOQ2ADfziUqy4BkuXQUgJEB4y2kj6w' | |
) | |
languages = [ |
This file contains hidden or 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
from scipy.misc import imread | |
from scipy.linalg import svd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
if __name__ == '__main__': | |
img = imread('mm.jpg') | |
h, w, c = img.shape |
This file contains hidden or 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
from collections import namedtuple | |
from operator import itemgetter | |
from pprint import pformat | |
class Node(namedtuple('Node', 'location left_child right_child')): | |
def __repr__(self): | |
return pformat(tuple(self)) | |
This file contains hidden or 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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
torch.manual_seed(1) | |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
CONTEXT_SIZE = 2 | |
EMBEDDING_DIM = 10 |
This file contains hidden or 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 torch | |
import torch.nn as nn | |
import numpy as np | |
def make_context_vector(context, word_to_ix): | |
idxs = [word_to_ix[w] for w in context] | |
return torch.tensor(idxs, dtype=torch.long) | |
def get_index_of_max(input): | |
index = 0 |
OlderNewer