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 | |
// run this file with `go run clientDoGzip.go, and then file tmp.out to verify body is gzipped | |
import "net/http" | |
import "io/ioutil" | |
import "bytes" | |
import "fmt" | |
import "log" | |
import "compress/gzip" |
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 ("bufio" | |
"fmt" | |
"io" | |
"net/http" | |
"net" | |
"strings") | |
type readFirstCloseSecond struct { |
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 ( | |
"io" | |
"os" | |
"time" | |
) | |
func singLine(line string,w io.Writer) { | |
time.Sleep(time.Second) |
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
This is a demonstration of how INT 13, ah=42 fails after a while. | |
Run 'bash debug.sh`, then hit `c` a couple of times, you should | |
see that INT 13 returns with CF set, which means it had an error. | |
Why is it happening? The code is pretty simple, all it does is reading | |
a sector from the disk, and copying it to some place in the memory. |
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" | |
import "net" | |
var localhost = net.ParseIP("127.0.0.1") | |
var port1, port2 = 1220, 1229 | |
func conwrite() { | |
c1, err := net.DialTCP("tcp", &net.TCPAddr{localhost, port2}, &net.TCPAddr{localhost, port1}) |
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
import org.junit.Test; | |
import java.net.InetAddress; | |
import java.net.InetSocketAddress; | |
import java.net.Socket; | |
import java.net.SocketException; | |
/** | |
* This tests make sure Java prevents a socket from connecting to itself | |
* via binding to the same port it connects to |
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 <stdio.h> | |
#include <poll.h> | |
#include <fcntl.h> | |
int main() { | |
int fd = open("/dev/null", O_WRONLY); | |
struct pollfd pollfds = { fd, POLLOUT, 0 }; | |
if (fd < 0) { | |
perror("open"); |
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 bug | |
type returnPanic struct { | |
err error | |
} | |
func F() (err error) { | |
defer func() { | |
if _, ok := recover().(returnPanic); !ok { | |
panic(err) |
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 | |
func Panic() { panic("oooh, no stacktrace") } | |
func make_bt_longer() { | |
Panic() | |
} | |
func main() { | |
Completer = func (text string, start, end int) (replacement string, options []string) { |
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
#import <Foundation/Foundation.h> | |
@interface POD : NSObject<NSCopying> | |
-(nonnull NSString *)description; | |
-(nonnull NSDictionary *)toDictionary; | |
+(nonnull id)fromDictionary:(nonnull NSDictionary *)dict; | |
-(nonnull id)copyWithZone:(nullable NSZone *)zone; | |
@end |