Skip to content

Instantly share code, notes, and snippets.

View bashkirtsevich's full-sized avatar
:octocat:
bashkirtsevich.github.io

D.A.Bashkirtsev bashkirtsevich

:octocat:
bashkirtsevich.github.io
View GitHub Profile
@bashkirtsevich
bashkirtsevich / gist:b94ab7b12746d317c71fc2300837a023
Created October 12, 2019 07:35 — forked from chrisdone/gist:02e165a0004be33734ac2334f215380e
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@bashkirtsevich
bashkirtsevich / readdisk.py
Created September 29, 2019 10:52 — forked from blaquee/readdisk.py
rawdisk python
import os
import sys
SECTOR_SIZE = 512
def main():
try:
if len(sys.argv) != 4:
raise Exception('Not Enough Arguments')
else:
@bashkirtsevich
bashkirtsevich / listfiles.py
Last active September 29, 2019 10:31 — forked from jonte/listfiles.py
Hack to parse FAT32
# https://www.easeus.com/resource/fat32-disk-structure.htm
import struct
import sys
def getBytes(fs, pos, numBytes):
fs.seek(pos)
byte = fs.read(numBytes)
if (numBytes == 2):
formatString = "H"
from random import randint
from time import sleep
flame = ' .,:;=<*i%IHM#'
fw = 128 # fire width
fh = 60 # fire height
fire = []
@bashkirtsevich
bashkirtsevich / linters.sh
Last active September 3, 2019 17:43
Codacy docker
docker run -it --rm -v $(pwd):/src codacy/codacy-sqlint:latest
docker run -it --rm -v $(pwd):/src codacy/codacy-pylint:latest
docker run -it --rm -v $(pwd):/src codacy/codacy-pylint-python3:latest
docker run -it --rm -v $(pwd):/src codacy/codacy-remark-lint:latest
docker run -it --rm -v $(pwd):/src codacy/codacy-bandit:latest
@bashkirtsevich
bashkirtsevich / dump.sh
Last active September 3, 2020 19:49
Dump github user
username=$1
repos=$(curl -s https://api.github.com/users/$username/repos?per_page=1000 | jq -r '.[] | .name + "|" + .clone_url')
for repo in $(echo $repos | tr " " "\n")
do
name=$(echo $repo | cut -d"|" -f1)
clone_url=$(echo $repo | cut -d"|" -f2)
git clone --mirror $clone_url ./$username/$name.git && tar -czvf ./$username/$name.tgz -C ./$username/$name.git .
rm -rf ./$username/$name.git
// Public repository
./gitdump.sh <repo_name>

// Your repository (public AND private)
./gitdump.sh <your_username> user

// Organization repository (public AND private)
./gitdump.sh <your_username> orgs <your_organization_name>
@bashkirtsevich
bashkirtsevich / sketch.ino
Last active July 27, 2019 17:52
Arduino LCD Keypad Shield test
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
#define BTN_UP 1
#define BTN_DOWN 2
#define BTN_LEFT 3
#define BTN_RIGHT 4
#define BTN_SELECT 5
#define BTN_NONE 10
@bashkirtsevich
bashkirtsevich / drafts.py
Last active August 23, 2019 15:05
Shit calculations
def get_chain_length(data):
return max(*reduce(lambda a, i: (max(a[0], a[1]), a[1] + 1 if i > 0 else 0), data, (0, 0)))
data = [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1]
print(get_chain_length(data))
def fib(n):
return reduce(lambda a, i: (a[1], a[0] + a[1]), range(n), (0, 1))[0]