ssh [email protected] -p 2221
password: eatmyshorts flag: aesebootiv hint: password is protected by the xor func memfrob from <string.h>
> memfrob - frobnicate (encrypt) a memory area
package main | |
import "fmt" | |
type S struct { | |
b [8]byte | |
} | |
func keys(m map[S]struct{}) [][]byte { | |
var z [][]byte |
package main | |
import "fmt" | |
type S struct { | |
b [8]byte | |
} | |
func main() { | |
mmap := map[S]struct{}{ |
ssh [email protected] -p 2221
password: eatmyshorts flag: aesebootiv hint: password is protected by the xor func memfrob from <string.h>
> memfrob - frobnicate (encrypt) a memory area
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int* p = (int *)malloc(sizeof(int)); | |
int* q = (int *)realloc(p, sizeof(int)); | |
*p = 1; | |
*q = 2; | |
if (p == q) |
package main | |
import "fmt" | |
type res struct { | |
s []byte | |
l int | |
r int | |
} |
Calculate XLOG entries distance between master and replica with:
on master:
> select pg_xlogfile_name(pg_current_xlog_flush_location()), pg_current_xlog_insert_location(), pg_current_xlog_location();
on slave:
-- Create a group | |
CREATE ROLE readonly WITH LOGIN; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readonly; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly; |
package main | |
import ( | |
"flag" | |
"log" | |
"math/rand" | |
"net/http" | |
"time" | |
) |
// Ivan Prisyazhnyy <[email protected]>, 2017 | |
// | |
// Ambiguities: | |
// - "URL syntax correctness" is not explicitly defined. Should, I | |
// interpret it, like it has to match rfc1738/rfc3986? I will go | |
// with the simplest solution - URL is valid if parsed by util.URL. | |
// - Various behaviors for edge cases (i.e. meeting bad data, unstable | |
// network, too much data) are not well defined. If external service | |
// returns 4/5xx code, it could be retried and etc. | |
// - Answering always within 500 milliseconds - this is the biggest |
location = /status { | |
default_type text/plain; | |
content_by_lua ' | |
local ok, upstream = pcall(require, "ngx.upstream") | |
if not ok then | |
error("ngx_upstream_lua module required") | |
end | |
local get_primary_peers = upstream.get_primary_peers |