Skip to content

Instantly share code, notes, and snippets.

View limitedeternity's full-sized avatar
🔭
Ищу смыслы

Vyacheslav Bespalov limitedeternity

🔭
Ищу смыслы
View GitHub Profile
@limitedeternity
limitedeternity / pow2_equiv.v
Last active December 22, 2022 10:09
"Bitwise hacks" proofs
Require Import Coq.Init.Nat Coq.Arith.PeanoNat Coq.Numbers.NatInt.NZPow Coq.Numbers.NatInt.NZBits Lia.
Theorem shiftr_div_pow2 : forall (a n : nat),
shiftr a n = a / 2 ^ n.
Proof.
intros. Nat.bitwise. rewrite Nat.shiftr_spec'. symmetry. apply Nat.div_pow2_bits.
Qed.
Lemma shiftl_mul_pow2 : forall (a n : nat),
shiftl a n = a * 2 ^ n.
@limitedeternity
limitedeternity / enumerate_eq_range.v
Last active July 18, 2022 08:59
for i, _ in enumerate(l, s) = for i in range(s, len(l) + s)
Require Import Coq.Lists.List Coq.Bool.Bool Lia.
Import Coq.Lists.List.ListNotations.
Fixpoint _range (a b d : nat) :=
match d with
| 0 => []
| S n => a :: _range (S a) b n
end.
@limitedeternity
limitedeternity / Pipfile
Last active August 14, 2022 13:48
A script for fetching minimum required information to migrate from GitHub
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests = "==2.27.1"
[dev-packages]
black = "*"
@limitedeternity
limitedeternity / gol.py
Last active January 3, 2022 08:31
Conway's Game of Life implemented using NumPy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
Z = np.random.randint(2, size=(300, 600))
def update(*args):
global Z
set BUILD_OPTIONS="-sZLIB_SOURCE=c:\SDK\ZLIB\zlib-1.2.11" -j 16 --abbreviate-paths --build-type=complete --layout=versioned link=static runtime-link=static threading=multi
set TARGET_DIR=C:\SDK\Boost\boost_1_76_0
md %TARGET_DIR%\include
md %TARGET_DIR%\include\boost
robocopy .\boost %TARGET_DIR%\include\boost\ /MIR
call bootstrap.bat
call b2.exe --stagedir=%TARGET_DIR% --toolset=msvc-14.2 address-model=32 cflags=/arch:SSE cxxflags=/arch:SSE %BUILD_OPTIONS% debug release stage
call b2.exe --stagedir=%TARGET_DIR% --toolset=msvc-14.1 address-model=32 cflags=/arch:SSE cxxflags=/arch:SSE %BUILD_OPTIONS% debug release stage
call b2.exe --stagedir=%TARGET_DIR% --toolset=msvc-14.0 address-model=32 cflags=/arch:SSE cxxflags=/arch:SSE %BUILD_OPTIONS% debug release stage
@limitedeternity
limitedeternity / index.js
Last active March 20, 2025 17:50
A Scribd-Downloader that actually works
const path = require("path");
const fs = require("fs");
const puppeteer = require("puppeteer-extra").use(require("puppeteer-extra-plugin-stealth")());
const imagesToPdf = require("images-to-pdf");
(async () => {
const browser = await puppeteer.launch({
userDataDir: path.join(process.cwd(), "tmp"),
ignoreHTTPSErrors: true,
headless: false,
@limitedeternity
limitedeternity / data.json
Created February 8, 2021 11:23
Determine mutual friends between multiple VK profiles
{
"comments": [
{
"comment-text": "Приложение отличное, надеюсь оно поможет молодым людям определить свою проф ориентацию",
"user-first-name": "Миша",
"user-id": 307227997,
"user-image": "https://sun9-68.userapi.com/c858032/v858032966/1f57a0/p3Wq3jmCDMk.jpg?ava=1",
"user-last-name": "Селиверстов"
},
{
@limitedeternity
limitedeternity / id_fold.v
Last active July 15, 2022 08:41
foldr I combinator composition
Require Import Coq.Program.Basics Coq.Lists.List FunctionalExtensionality.
Import Coq.Lists.List.ListNotations.
Fixpoint replicate (T : Type) (e : T) n :=
match n with
| 0 => []
| S n => e :: replicate T e n
end.

Compile steghide in macOS X

Check if dependencies are installed:

$ brew install gettext libjpeg libmcrypt mhash

Construct LDFLAGS and CPPFLAGS, then configure with those:

$ brew info gettext | grep "/usr/local/Cellar"
@limitedeternity
limitedeternity / id_rsa_brute.py
Last active August 13, 2020 19:55
SSH private key bruteforce utility
#!/usr/bin/env python
import subprocess
import sys
import pipes
def cmdline(command):
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
return err