This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void strcat_realloc(char** buff, char* str, intmax_t str_len, intmax_t* buff_size, intmax_t* buff_pos) | |
{ | |
assert(buff != NULL); | |
assert(str != NULL); | |
assert(buff_size != NULL); | |
assert(buff_pos != NULL); | |
if(*buff_size - *buff_pos - 1 > str_len) | |
{ | |
strcat(*buff, str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int alloc_snprintf(char** out, const char* template, ...) | |
{ | |
va_list list; | |
va_start(list, template); | |
int len = vsnprintf(NULL, 0, template, list); | |
va_end(list); | |
char* new_string = malloc((size_t)len + 1); | |
assert(new_string != NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REMOTE=server.com | |
REMOTE_PATH=/mnt/backup | |
DATE=$(date +%F) | |
LOCAL_PATH="/home/cactus /etc" | |
LOCAL_EXCLUDE=/etc/cron.daily/backup_exclude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conky.config = { | |
alignment = 'top_right', | |
background = false, | |
double_buffer = true, | |
border_width = 1, | |
cpu_avg_samples = 2, | |
default_color = 'white', | |
default_outline_color = 'white', | |
default_shade_color = 'white', | |
default_bar_height = 8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Клонируем исходный репозиторий без рабочего каталога (--bare) | |
git clone --bare https://github.com/exampleuser/old-repository.git | |
cd old-repository.git | |
# Делаем mirror-push(будут скопированы все ветки и тэги) в новый репозиторий | |
git push --mirror https://github.com/exampleuser/new-repository.git | |
cd .. | |
# Удаляем папку с репозиторием |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Template used to create this container: /usr/share/lxc/templates/lxc-debian | |
# Parameters passed to the template: | |
# For additional config options, please look at lxc.container.conf(5) | |
# Uncomment the following line to support nesting containers: | |
#lxc.include = /usr/share/lxc/config/nesting.conf | |
# (Be aware this has security implications) | |
#lxc.net.0.type = empty | |
lxc.apparmor.profile = generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/nft -f | |
flush ruleset | |
define local = {192.168.16.0/24, 127.0.0.0/8 } | |
define out_if = enp0s3 | |
table nat { | |
chain prerouting { | |
type nat hook prerouting priority 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import font | |
class PCF8814: | |
pixel_width = 96 | |
pixel_height = 65 | |
def __init__(self, ss, rst, sck, mosi): | |
self.ss = ss | |
self.rst = rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import gc | |
HTTP_STATUS = """ | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>ESP Web Server:{status} Status Code</title> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
font8x6 = [ | |
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 20 [SPACE], | |
[0x00, 0x00, 0x00, 0x5f, 0x00, 0x00], # 21 ! | |
[0x00, 0x00, 0x07, 0x00, 0x07, 0x00], # 22 " | |
[0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14], # 23 # | |
[0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12], # 24 $ | |
[0x00, 0x23, 0x13, 0x08, 0x64, 0x62], # 25 % | |
[0x00, 0x36, 0x49, 0x55, 0x22, 0x50], # 26 & | |
[0x00, 0x00, 0x05, 0x03, 0x00, 0x00], # 27 ' | |
[0x00, 0x00, 0x1c, 0x22, 0x41, 0x00], # 28 ( |
OlderNewer