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
//go:noinline | |
func IpToLong(ipStr string) uint32 { | |
ptr := unsafe.Pointer(unsafe.StringData(ipStr)) | |
var ( | |
n uint32 | |
oct uint32 | |
p = ptr | |
) | |
// 第一段: XXX. |
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
#!/bin/bash | |
# call this script with an email address (valid or not). | |
# like: | |
# ./makecert.sh [email protected] | |
mkdir certs | |
rm certs/* | |
echo "make server cert" | |
openssl req -new -nodes -x509 -out certs/server.pem -keyout certs/server.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1" | |
echo "make client cert" | |
openssl req -new -nodes -x509 -out certs/client.pem -keyout certs/client.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1" |
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 events | |
import ( | |
"sync" | |
"context" | |
) | |
type Dispatcher struct { | |
mutex *sync.RWMutex | |
listeners map[string][]Listener |
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 ( | |
"database/sql" | |
"log" | |
) | |
func main() { | |
db, err := sql.Open("VENDOR_HERE", "YOUR_DSN_HERE") | |
handleError(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 | |
import ( | |
"fmt" | |
"runtime" | |
"strconv" | |
"sync" | |
"time" | |
) |
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
/ Convert IPv4 range into CIDR | |
func iPv4RangeToCIDRRange(ipStart string, ipEnd string) (cidrs []string, err error) { | |
cidr2mask := []uint32{ | |
0x00000000, 0x80000000, 0xC0000000, | |
0xE0000000, 0xF0000000, 0xF8000000, | |
0xFC000000, 0xFE000000, 0xFF000000, | |
0xFF800000, 0xFFC00000, 0xFFE00000, | |
0xFFF00000, 0xFFF80000, 0xFFFC0000, | |
0xFFFE0000, 0xFFFF0000, 0xFFFF8000, |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<HTML> | |
<HEAD> | |
<TITLE>Ping and mtr from multiple locations – xkjrch3.x.incapdns.net</TITLE> | |
<meta name="GENERATOR" content="Hands"> | |
<meta http-equiv="content-type" Content="text/html;charset=utf-8"> | |
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> | |
<meta name="description" http-equiv="description" content="The Best Ping+MTR combination Ever."> |
NewerOlder