Skip to content

Instantly share code, notes, and snippets.

View krared's full-sized avatar
📡
sudo halt -q

krared krared

📡
sudo halt -q
View GitHub Profile
@krared
krared / gentoo_install.sh
Last active February 20, 2024 17:56
gentoo_install.sh
# https://wiki.gentoo.org/wiki/Handbook:Parts/Full/Installation/ru#Preparing_for_a_bootloader
# https://docs.google.com/presentation/d/1SXYB4gOw2psL1SKD6gAC7akyiVb9S1AqqMdLHqqg_Vc/pub?slide=id.g1491c09ef8_0_47
# https://www.youtube.com/watch?v=Lwed13zSS_0
# https://danielmiessler.com/p/the-difference-between-system-v-and-systemd/
# https://wiki.gentoo.org/wiki/CPU_FLAGS_*/ru
# https://wiki.gentoo.org/wiki/OpenRC_to_systemd_Cheatsheet
# https://lna.org.ru/book/export/html/53
@krared
krared / docker-compose-images-save.sh
Created February 8, 2024 14:21
docker-compose-images-save.sh
#!/bin/bash
dc=${1}
if [ ! -z ${dc} ] && [ -f ${dc} ]; then
echo "Saving docker images from file ${dc}..."
images=`grep image: ${dc} | awk '{print $2}'`
docker save ${images} | gzip > docker-images.gz
echo "Success!"
else
@krared
krared / bash_aliases
Created February 8, 2024 13:29
.bash_aliases
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@krared
krared / split.py
Last active December 19, 2023 08:11
split.py
def split_file(input_file, lines_per_segment=1000000, encoding='utf-8'):
with open(input_file, 'r', encoding=encoding) as file:
content = file.readlines()
num_segments = len(content) // lines_per_segment + (len(content) % lines_per_segment > 0)
for i in range(num_segments):
start_idx = i * lines_per_segment
end_idx = (i + 1) * lines_per_segment
segment_content = content[start_idx:end_idx]
@krared
krared / Xerox Phaser 3140 macOS Catalina driver update
Created December 14, 2022 07:46 — forked from santiago26/Xerox Phaser 3140 macOS Catalina driver update
How to get worked old Xerox printer in macOS Catalina
# Intro
Xerox said that Phaser 3140 hass "level 2" of support which means that Xerox not planning to update it's driver any way.
macOS no longer supports 32bit apps since macOS Catalina, and Xerox drivers installer provided at xerox.com is 32bit-app. But drivers will still work if we can install it. So we just need to install drivers itself manually.
To make it old printers work you just need to copy few files from installer to their designed locations.
# Download
You can download unpacked files from macOS 10.14 (10.11+) or unpack from official site by yourselve.
https://yadi.sk/d/K4Z-FlHFTyT2BQ?w=1
#Installation
@krared
krared / busybox.yaml
Last active November 2, 2022 14:20
k8s
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- image: busybox
command:
- sleep
@krared
krared / mcopy.py
Last active February 15, 2022 16:04
multithread copy for low sized files
import os
from os.path import join as jn
from shutil import copyfile
from multiprocessing import Pool, cpu_count
from datetime import datetime
from tqdm import tqdm
src = "/Users/krared/from"
dest = "/Users/krared/to"
@krared
krared / python_useful.py
Last active March 16, 2024 16:40
python useful
# divide set on 3 parts
import pickle
import numpy as np
your_set = {'1','2','3'}
triple_split = np.array_split(your_set, 3)
name_of_split = 'set_of_'
for i in range(len(triple_split)):
with open(f'{name_of_split}_{i}.pickle', 'wb') as handle:
--------- SET STATIC IP ---------
sudo nano /etc/netplan/01-netcfg.yaml
sudo nano /etc/hosts
ip1 k8s-master
ip2 k8s-node1
ip3 k8s-node2
sudo netplan apply
ip a
@krared
krared / gist:7e36e3b924197b12f768cb5b42c6831f
Last active February 14, 2022 08:02
adb fastboot install automate apps
adb reboot bootloader
fastboot flash recovery twrp.img
# fastboot boot twrp.img
fastboot reboot recovery
adb reboot recovery
for file in *.apk; do adb install $file; done