Skip to content

Instantly share code, notes, and snippets.

let stringify = require('json-stable-stringify'); // canonical json implementation
let md5 = require('md5');
let base64 = require('base-64');
let sha1 = require('sha1');
let amount = 1;
let merch_data = {
amount: amount,
order_id: ++last_order_id,
currency: "RUB",
@mrsndmn
mrsndmn / gist:398cb8ee738acaa8c05cd1a917a24d6c
Last active October 27, 2019 13:54
git mr function to not to write task num each time
gcamm() {
local b="$(git_current_branch)"
local task="$(perl -E 'print( (split /\./, $ARGV[0], 2)[0] )' $b)"
echo $task
[[ "$task" != "" ]] && git commit --verbose -am "$task $1"
}
gcmm() {
local b="$(git_current_branch)"
@mrsndmn
mrsndmn / tmux.conf
Last active October 27, 2019 14:15
setw -g mode-keys vi
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# unbind shift and ctl
@mrsndmn
mrsndmn / re.pl
Last active December 11, 2019 10:33
use Devel::REPL;
my $repl = Devel::REPL->new;
$repl->load_plugin($_) for qw(
History LexEnv DDS PPI DDP
Completion
CompletionDriver::INC
CompletionDriver::Keywords
CompletionDriver::Methods
Editor
@mrsndmn
mrsndmn / bench_lwp_ae_http.pl
Last active December 17, 2019 18:27
Perl AnyEvent::HTTP and LWP::Protocol::Coro::http benchmark
=head1 install deps
cpm install AnyEvent::HTTP LWP::Protocol::Coro::http
=head1 bench result
Rate aehttp_socks aehttp my_lwp state_lwp
aehttp_socks 183/s -- -1% -6% -17%
aehttp 185/s 1% -- -5% -16%
my_lwp 195/s 6% 5% -- -12%
state_lwp 221/s 20% 19% 13% --
go test -v -bench=BenchmarkIteratorNext -benchmem
...
BenchmarkIteratorNext-8 2000732 576 ns/op 8 B/op 0 allocs/op
go test -v -bench=BenchmarkIteratorNext -benchmem -cpuprofile=cpu.out -memprofile=mem.out -memprofilerate=1
...
BenchmarkIteratorNext-8 513028 2746 ns/op 8 B/op 1 allocs/op
import random
from ctypes import CDLL
libc = CDLL("libc.so.6")
asciiRange = 0x7E - 0x20
ans = []
with open("ctf.in110", 'r') as f:
@mrsndmn
mrsndmn / main.go
Created July 22, 2020 09:25
errors pkg/errors merry
package main
import (
errors "errors"
"fmt"
"testing"
pkgerrors "github.com/pkg/errors"
"github.com/ansel1/merry"
from team_code.generate import get_ppl, generate_text, setup_model_and_tokenizer
def test_generate_text_get_ppl():
model, tokenizer = setup_model_and_tokenizer()
queries = [
[{"type": "text", "content": "What is the capital of Great Britain?"}],
[{"type": "text", "content": "And what is the famous place there?"}]
]