Skip to content

Instantly share code, notes, and snippets.

View sqn175's full-sized avatar
🎯
Focusing

Qin Shi sqn175

🎯
Focusing
  • Tsinghua University
  • Beijing, China
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="std::pair&lt;*&gt;">
<DisplayString>({first}, {second})</DisplayString>
<Expand>
<Item Name="first">first</Item>
<Item Name="second">second</Item>
@sqn175
sqn175 / converter.cpp
Last active July 26, 2017 09:04
Convert string to numeric array
// filename.txt:
// 62416 X:13356763.312410861;Y:3549864.575675777
// 62415 X:13356766.027865667;Y:3549869.0388435153
while( std::getline(filename, line) )
{
std::size_t sz1,sz2 = 0;
int minor = std::stoi(beaconLine, &sz1);
double x = std::stod(beaconLine.substr(sz1+3),&sz2);
double y = std::stod(beaconLine.substr(sz1 + 3 + sz2 + 3));
@sqn175
sqn175 / gist:bdfc105eb15e7675e5e4fbf765a68bbf
Last active July 6, 2017 06:27
Ubuntu install ss-qt5
sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5
@sqn175
sqn175 / example.cpp
Created May 7, 2017 07:04
类重载函数调用运算符
class PrintString
{
public:
PrintString(ostream &o = cout, char = ' '):
os(o), sep(c) { }
void operator()(const string &s) const { os<<s<<sep; }
private:
ostream &os; //用于写入的目的流
char sep; //用于将不同输出隔开的字符
};