Skip to content

Instantly share code, notes, and snippets.

@Termina1
Termina1 / aoc.rs
Last active November 26, 2021 14:11
Aoc FdW on pgx
use serde::Deserialize;
use std::{collections::HashMap, result::*};
pub struct AocOptions {
pub api: &'static str,
pub cookie: &'static str,
}
pub fn deserialize_ts<'de, D>(deserializer: D) -> Result<i32, D::Error>
where
#!/bin/zsh
export XDG_CACHE_HOME=${XDG_CACHE_HOME:=~/.cache}
typeset -A ZINIT
ZINIT_HOME=$XDG_CACHE_HOME/zsh/zinit
ZINIT[HOME_DIR]=$ZINIT_HOME
ZINIT[ZCOMPDUMP_PATH]=$XDG_CACHE_HOME/zsh/zcompdump
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
@Termina1
Termina1 / Dockerfile
Last active January 30, 2021 12:36
Multistage docker container for building tensorflow from source Ubuntu 20.04
FROM ubuntu:20.04 as cuda
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install --no-install-recommends -y build-essential git \
wget make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl \
llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev ca-certificates gnupg
RUN git clone https://github.com/pyenv/pyenv.git /root/pyenv
RUN /root/pyenv/bin/pyenv install 3.8.0
RUN ln -s /root/.pyenv/versions/3.8.0/bin/python /usr/bin/python
RUN ln -s /root/.pyenv/versions/3.8.0/bin/pip /usr/bin/pip
@Termina1
Termina1 / day15.c
Last active December 15, 2020 19:47
#define CYCLES 30000000
#include <stdlib.h>
#include <stdio.h>
static int memory[CYCLES] = {[19] = 1, [0] = 2, [5] = 3, [1] = 4, [10] = 5};
int main () {
int i = 7;
int prev = 13;
int k;
@Termina1
Termina1 / bot.js
Last active March 9, 2019 13:19
Примеры ботов
// Запрашиваем библиотеку
var VK = require('vk-call').VK;
// Указываем access_token (ключ доступа)
var token = '541a0b8dec33a2098882...4392ccbbd962cf';
// Версию API
var version = '5.92';
// Создаем объект для работы с api используя данные выше
module Ex06e
//insertion-sort
(* Check that a list is sorted *)
val sorted: list int -> Tot bool
let rec sorted l = match l with
| [] -> true
| [x] -> true
| x::y::xs -> (x <= y) && (sorted (y::xs))
validateAstAndConvertToStore' : TLProgram -> Eff () [STATE TLStore]
validateAstAndConvertToStore' x = ?validateAstAndConvertToStore'_rhs
validateAstAndConvertToStore : TLProgram -> TLStore
validateAstAndConvertToStore x = let initStore = MkTLStore empty empty empty in
let test = run (validateAstAndConvertToStore' x) in
?hole
### Keybase proof
I hereby claim:
* I am termina1 on github.
* I am thought_sync (https://keybase.io/thought_sync) on keybase.
* I have a public key whose fingerprint is 2AD6 D5B3 EFF4 288E 61F3 57CE C2C1 B06C 79D7 CD3B
To claim this, I am signing this object:
@Termina1
Termina1 / bitsToHex.idr
Last active December 12, 2016 13:34
Conversion from Bits 32 to hex String
bitsToBytes : Bits 32 -> Vect 4 (Bits 8)
bitsToBytes x = bitsToBytes' 4 x
where
bitsToBytes' : (n : Nat) -> Bits 32 -> Vect n (Bits 8)
bitsToBytes' Z x = []
bitsToBytes' (S k) bits = let prevBits = bitsToBytes' k bits in
let shifted = shiftRightLogical bits (MkBits $ natToBits {n = nextBytes 32} k * 8) in
let nextByte = truncate {m = 24} {n = 8} shifted in
nextByte :: prevBits
module crc32
import Data.Bits
g0 : Bits 32
g0 = intToBits 0xEDB88320
g1 : Bits 32
g1 = shiftRightLogical g0 (intToBits 1)