Skip to content

Instantly share code, notes, and snippets.

View FrBrGeorge's full-sized avatar

Fr. Br. George FrBrGeorge

View GitHub Profile
@FrBrGeorge
FrBrGeorge / dl-cloud-mail-ru.sh
Created October 23, 2022 12:56 — forked from cronfy/dl-cloud-mail-ru.sh
Download file from cloud.mail.ru from linux console with bash script
#!/usr/bin/env bash
# Скрипт по загрузке публичных файлов с Облака mail.ru. Поддерживается докачка.
# v1.0.5 от 2022-05-30
#
# ЕСЛИ СКРИПТ НЕ РАБОТАЕТ
#
# 1. Убедитесь, что файл доступен публично. Возможна загрузка только публичных файлов.
# 2. Mail.ru время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта.
# Если скрипт не работает, просьба сделать работающий форк и скинуть ссылку в комментарии.
@FrBrGeorge
FrBrGeorge / tree.md
Created July 29, 2022 16:51 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@FrBrGeorge
FrBrGeorge / socatandudp.txt
Created March 27, 2022 18:47 — forked from jdimpson/socatandudp.txt
socat and UDP
(originally written in 2009 and posted to livejournal! https://jdimpson.livejournal.com/6812.html
The last article teaches how to use socat by comparing it first to cat then to netcat. It skimped on socat's UDP-related features, because netcat only implements a subset of them. This article picks up where the last one left off, with respect to UDP. After this article will be one more that discusses advanced socat features.
It turns out there are a lot of subleties when dealing with UDP, even before multicast is mixed in. We'll abandon the comparisons to netcat, as we've exceeded what netcat can do. But first a quick reminder of one way socat does UDP.
socat as a UDP server on port 11111.
socat STDIO UDP-LISTEN:11111
@FrBrGeorge
FrBrGeorge / task2.pas
Created October 3, 2021 14:22
check if time is in hh:mm:ss format
procedure Check(d: string; var res: boolean; var hms: vec);
var
i, r: integer;
begin
res := length(d) = 8;
if not res then exit;
res := (d[3] = ':') AND (d[6] = ':');
if not res then exit;
for i:=1 to 3 do
begin
@FrBrGeorge
FrBrGeorge / BCC
Last active August 31, 2020 13:04
#!/bin/sh
DOSBOX=/usr/bin/dosbox
BCCDIR=${BCCDIR:-/home/george/.doses/BC}
BCCBAT="$BCCDIR/BCCRUN.BAT"
BCCP2M=""
case "$1" in
*.c|*.C|*.CPP|*.cpp|*.cxx|*.CXX|*.cc|*.CC)
SRCDIR=$(dirname $(realpath "$1"))
BCCBUILD="BCC `basename "$1"`"
@FrBrGeorge
FrBrGeorge / nve.cc
Last active May 31, 2019 21:14
c++ vector with a bit of <functional>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
template <typename T>
class vect: public vector<T> {
@FrBrGeorge
FrBrGeorge / dopipe.c
Last active March 16, 2017 12:34
pipe+fork+exec
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(void)
{
int pipefd[2], res;
pid_t pout, pin, pwait;