Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
| function decrypt_session(cookie) { | |
| const SALT = "authenticated encrypted cookie"; | |
| const secret = crypto.pbkdf2Sync(secret_key_base, SALT, 1000, 32, 'sha1'); | |
| const [data, iv, auth_tag] = cookie.split('--').map(s => Buffer.from(s, 'base64')); | |
| const decipher = crypto.createDecipheriv('aes-256-gcm', secret, iv); | |
| decipher.setAuthTag(auth_tag); | |
| let decrypted_data = decipher.update(data); | |
| decrypted_data = Buffer.concat([decrypted_data, decipher.final()]); |
| [package] | |
| name = "xxx" | |
| version = "0.1.0" | |
| edition = "2021" | |
| [profile.release] | |
| opt-level = 3 | |
| debug = 2 |
| use svg::{ | |
| node::{ | |
| self, | |
| element::{path::Data, Path, Text}, | |
| }, | |
| Document, | |
| }; | |
| const WIDTH: f64 = 70.0; | |
| const STROKE_WIDTH: f64 = 0.6; |
| use std::fs::read_to_string; | |
| use chrono::{DateTime, FixedOffset, NaiveDate, TimeZone, Utc}; | |
| type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; | |
| #[derive(Debug)] | |
| struct RawEvent { | |
| start: Option<DateTime<FixedOffset>>, | |
| end: Option<DateTime<FixedOffset>>, |
| use anyhow::Result; | |
| use reqwest::ClientBuilder; | |
| use scraper::{Html, Selector}; | |
| use serde::Deserialize; | |
| use std::collections::{HashMap, HashSet}; | |
| #[tokio::main] | |
| async fn main() -> Result<()> { | |
| let client = ClientBuilder::new().gzip(true).build()?; | |
| let cookie = "..."; |
| use anyhow::Result; | |
| use reqwest::ClientBuilder; | |
| use serde::Deserialize; | |
| use std::collections::{HashMap, HashSet}; | |
| #[tokio::main] | |
| async fn main() -> Result<()> { | |
| let client = ClientBuilder::new().gzip(true).build()?; | |
| let models: HashMap<String, ProblemModel> = client | |
| .get("https://kenkoooo.com/atcoder/resources/problem-models.json") |
| #!/bin/bash | |
| set -eu | |
| # Topcoder MM の実行可能ファイルのパス | |
| # 一時ファイルは /workdir に置くといいらしい | |
| TEMP_PATH="/workdir/a.out" | |
| rm -f submission.zip | |
| cargo clean |
| #!/usr/bin/env python | |
| # | |
| # Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to | |
| # compress e. g. bookmark backups (*.jsonlz4). | |
| # | |
| # This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and | |
| # uncompressed file size [4 bytes, little endian]). | |
| # | |
| # This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4 | |
| # |
| - 切った後の長方形の数 = 切り分けた線分の数 + 1 なので、線分の数を数えることにする。 | |
| - 線分は周囲に3つのブロックがある格子点を端点に持っている。 | |
| - 周囲に3つのブロックがある格子点を凹点と呼ぶことにする。 | |
| - 全てのピースが長方形であるということは凹点が存在しないということ。 | |
| - 線分の数は凹点の数でおさえられる。 | |
| - 凹点同士を結ぶ線分が多ければ多いほどよい。 | |
| - 線分の数 = 凹点の数 - 凹点同士を結ぶ線分の数 | |
| - 凹点同士を結ぶ線分を1本引くと2つの凹点を潰すことが出来るため | |
| - 凹点同士を結ぶ線分を2本交わるように引いても4つの凹点を潰したことにはならない。 | |
| - 1本目の線分を引いた時点で多角形が切り分けられ、2本目は凹点同士を結ぶ線分にならない。 |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.