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] | |
name = "async-share" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
tokio = { version = "1.21.1", features = ["fs","sync","macros","rt"] } | |
sqlx = { version = "0.6.2", features = ["postgres","runtime-tokio-rustls","chrono"] } |
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
{-# LANGUAGE GADTs, DataKinds, UndecidableInstances, KindSignatures, TypeOperators, TypeFamilies #-} | |
module Prime where | |
import Data.Type.Bool | |
import Data.Type.Equality | |
import GHC.TypeLits | |
import Data.Kind | |
import Data.Proxy | |
type family IsFactorization (n :: Nat) (l :: [Nat]) :: Bool where | |
IsFactorization 0 l = False |
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
from Crypto.Util.number import * | |
from functools import reduce | |
import random | |
p = 0xfffffed83c17 | |
phi = p - 1 | |
def factor(): | |
c = phi | |
res = [] | |
for i in range(2,152): |
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
% -*- coding: utf-8 -*- | |
@require: stdja | |
%let-inline ctx \hoge ?:x y = | |
% match x with | |
% | Some x -> read-inline ctx x | |
% | None -> read-inline ctx (embed-string `none`) in | |
let-inline ctx \piyo ?:x = | |
match x with |
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
{-# LANGUAGE BangPatterns #-} | |
module Queue (Queue, empty, snoc, head, tail) where | |
import Prelude hiding(head,tail) | |
-- invariant: | |
-- length (frontList q) - length (tailList q) - length (thunk q) == 0 | |
data Queue a = | |
Queue { | |
frontList :: [a] -- O(1) to be evaluated to WHNF | |
, tailList :: [a] -- should be strict |
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
{-# LANGUAGE BangPatterns #-} | |
module Queue (Queue, empty, snoc, head, tail) where | |
import Prelude hiding(head,tail) | |
-- invariant: | |
-- length (frontList q) == length (tailList q) + length (thunk q) | |
data Queue a = | |
Queue { | |
frontList :: [a] | |
, tailList :: [a] |
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
#include<stdio.h> | |
#include<stdlib.h> | |
#include<string.h> | |
#include<sys/mman.h> | |
#include<sys/types.h> | |
#include<sys/stat.h> | |
#include<unistd.h> | |
#include<fcntl.h> | |
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
def I(s): | |
val = 0 | |
for i in range(len(s)): | |
digit = ord(s[len(s) - i - 1]) | |
val <<= 8 | |
val |= digit | |
return val | |
def Sn(i, length): | |
s = '' |
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
p = 606341371901192354470259703076328716992246317693812238045286463; | |
g = [ 160057538006753370699321703048317480466874572114764155861735009, 255466303302648575056527135374882065819706963269525464635673824] * Mod(1,p) | |
A = [460868776123995205521652669050817772789692922946697572502806062, 263320455545743566732526866838203345604600592515673506653173727] * Mod(1,p) | |
B = [ 270400597838364567126384881699673470955074338456296574231734133, 526337866156590745463188427547342121612334530789375115287956485] * Mod(1,p) | |
Y0 = (g[1] / g[2] - 1); | |
Y1 = (A[1] / A[2] - 1); | |
Y2 = (B[1] / B[2] - 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
import subprocess | |
import struct | |
import binascii | |
import random | |
import time | |
remote = True | |
if remote: | |
cmd = "nc inst-prof.ctfcompetition.com 1337" | |
else: |
NewerOlder