Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Mikhail Andreev adw0rd

I may be slow to respond.
Block or report user

Report or block adw0rd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import sys
def main(text):
n, s, result = '', '', []
for i in text:
if i.isdigit():
n += i
if n:
View python 5
[[1, 2, 3, 4, 5],
[16, 17, 18, 19, 6],
[15, 24, 25, 20, 7],
[14, 23, 22, 21, 8],
[13, 12, 11, 10, 9]]
def _make_shift_statistic(self):
"""Make result and persent statistic by shift.
result = self._give_by_shift()
result.pop('rock_mass', None)
return self.statistic(
'Повахтовый выход, %',
'Повахтовая добыча м\u00B3'
View postgres dump all databases
for db in `psql -qtc 'SELECT datname from pg_database' | grep -v template`;
do pg_dump -Fc $db | gzip -9 > $db.sql.gz;
View qemu
brew install qemu
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
mv Docker.qcow2 Docker.qcow2.orig
qemu-img convert -O qcow2 Docker.qcow2.orig Docker.qcow2
class Dad:
def print_shit(self, shit):
class Son(Dad):
def some_function(self):
def mini_function(word):
adw0rd /
Last active Nov 22, 2018
Inherentsy issue
class Grandpa:
def print_some_shit(self, item):
class Dad(Grandpa):
def __init__(self):
self.shit = 'hello'
class Child(Dad):
View docker in docker
docker run -ti --privileged --rm ubuntu bash
apt update && apt install -y
service docker start
docker ps
View inheritance
class Base:
prop = 42
other = 1
def func(self):
print('Base func')
return self.prop
class Child(Base):
View swapon
swapon -s
cp /etc/fstab /etc/fstab.bak
# For 4 CPU Core create 4 swap files:
for i in $(seq 0 3); do
fallocate -l 1G /swapfile$i;
mkswap /swapfile$i;
swapon /swapfile$i -p 10
echo "/swapfile$i none swap sw 0 0" >> /etc/fstab;
You can’t perform that action at this time.