hoge
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
uint32_t Read32(const char* data) { | |
return static_cast<unsigned char>(data[0]) | |
| (static_cast<unsigned char>(data[1]) << 8u) | |
| (static_cast<unsigned char>(data[2]) << 16u) | |
| (static_cast<unsigned char>(data[3]) << 24u); | |
} |
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
int main() { | |
char b = -1; | |
cout << static_cast<int>(b) << endl; | |
cout << static_cast<uint32_t>(b) << endl; | |
cout << static_cast<uint32_t>(static_cast<unsigned char>(b)) << endl; | |
} |
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
class Base; | |
class Sub; | |
shared_ptr<Base> create(Kind k) { | |
switch (k) { | |
case kHoge: | |
return shared_ptr<Base>(new Sub()); | |
} | |
return shared_ptr<Base>(); | |
} |
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
#include <cstdio> | |
#include <cstdlib> | |
#include <vector> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <sys/time.h> | |
#include <sys/ioctl.h> |
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
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <vector> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <sys/time.h> |
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/python34 | |
import codecs | |
import mistune | |
md_text = '''\ | |
this is markdown. | |
``` |
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/python3 | |
import json | |
import re | |
from socket import gethostname | |
from subprocess import check_output | |
MEM_INFO_PATTERN = re.compile('^([^ ]+): *([0-9]+) ?([A-Za-z]+)?$') |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
"unicode" | |
"unicode/utf8" | |
) | |
func skipSpaces(s []byte) []byte { |
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
$ dig www.iij.ad.jp. AAAA | |
; <<>> DiG 9.9.5-11ubuntu1.3-Ubuntu <<>> www.iij.ad.jp. AAAA | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33579 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 | |
;; OPT PSEUDOSECTION: | |
; EDNS: version: 0, flags:; udp: 4096 |