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
# quic-cleanup.pl | |
# | |
# When running the Google experimental quic_server it expects to find | |
# sites to serve in /tmp/quic-data. Under that there will be a | |
# directory per site. | |
# | |
# For example this was used to mirror the CloudFlare web site for | |
# QUIC testing. | |
# | |
# mkd |
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
% perl rsa.pl rsa65537.key | |
Exponent 65537 | |
Plaintext [2374623765656] | |
Ciphertext [54189570645149678794693940654778175623133064659696656007570945283886977179371080120152561977021117382440218161492193509392092366273501288958199326710633675404929026067821522578649296730459190572345487456189328545191187492476957378888329005173000564263384860107839239781974940823115540499210407765338815164272] | |
% perl rsa.pl rsa1.key | |
Exponent 1 | |
Plaintext [2374623765656] | |
Ciphertext [2374623765656] |
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
local ffi = require("ffi") | |
ffi.cdef[[ | |
typedef long time_t; | |
typedef struct timeval { | |
time_t tv_sec; | |
time_t tv_usec; | |
} timeval; |
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
local profiler = require 'lulip' | |
local p = profiler:new() | |
p:dont('some-module') | |
p:maxrows(25) | |
p:start() | |
-- execute code here | |
p:stop() | |
p:dump(output_file_name) |
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
local t = {} | |
local c = 1 | |
for i=1,5000000 do | |
t[c] = i | |
c = c + 1 | |
end |
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
func worker(die chan bool) { | |
for { | |
select { | |
// ... do stuff cases | |
case <- die: | |
return | |
} | |
} | |
} |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
) | |
func waitAround(die chan bool) { | |
<- die |
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
(setq last-location-file (concat my-emacs-d "/last-location")) | |
(defun load-last-location-file () | |
(if (file-exists-p last-location-file) | |
(read (with-temp-buffer | |
(insert-file-contents last-location-file) | |
(buffer-string))) | |
(make-hash-table :test 'equal))) | |
(setq last-location-table (load-last-location-file)) |
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
package counter | |
import ( | |
"io" | |
) | |
type Counter struct { | |
w io.Writer // Underlying writer to send data to | |
c int // Number of bytes written since last call to Count() | |
} |
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
func redirect(to string, from *os.File) (err error) { | |
if out, err := os.Create(name); err == nil { | |
err = syscall.Dup2(int(out.Fd()), int(from.Fd())) | |
} else { | |
err = fmt.Errorf("Unable to create file %s", to) | |
} | |
return | |
} |