Skip to content

Instantly share code, notes, and snippets.

@blrB
blrB / .zshrc
Created December 17, 2018 19:14
# eye rest timer
eye() {
for i in {1..$1}
do
echo "$i time"
sleep 30
(speaker-test -t sine -f 500 )& pid=$! ; sleep 0.1s ; kill -9 $pid
sleep 30
(speaker-test -t sine -f 1000 )& pid=$! ; sleep 0.1s ; kill -9 $pid
@blrB
blrB / downloader.c
Last active August 24, 2022 16:49
Downloader
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
@blrB
blrB / transformation_implication.m4scp
Last active November 28, 2018 21:26
LOIS lab2 m4SCP
m4include(m4define([m4currentFile],builtin(translit,__file__,\,/))builtin(regexp,m4currentFile,.*[/],\&)_config.m4)
M4SCS(
#include "../include/sckp_keynodes.scsy"
// Location: /lib/transformation_implication
)
// Равносильное преобразования импликации. (A->B) <=> ((!A)\/B)
procedure(logics_transformation_implication,[[
msg_start = /"TRANSFORMATION IMPLICATION PROCEDURE START!\n"/,
@blrB
blrB / euclideanalgorithm.cpp
Last active September 20, 2017 20:10
Euclidean algorithm & Extended Euclidean Algorithm C++ - https://en.wikipedia.org/wiki/Euclidean_algorithm
#include <QtCore/QtGlobal>
// Greatest common divisor (gcd) of two integers
// Euclidean Algorithm
qint64 euclideanAlgorithm(qint64 a, qint64 b) {
qint64 c;
while (b) {
c = a % b;
a = b;
b = c;
@blrB
blrB / reverse.m4scp
Last active November 28, 2018 21:26
LOIS lab1 m4SCP
m4include(m4define([m4currentFile],builtin(translit,__file__,\,/))builtin(regexp,m4currentFile,.*[/],\&)_config.m4)
M4SCS(
#include "../../include/sckp_keynodes.scsy"
// Location: /lib/chain/reverse
)
procedure(chain_reverse,[[
msg_start = /"REVERS PROCEDURE START!\n"/,
msg_finish = /"REVERS PROCEDURE FINISH!\n"/,
push_first_singlet = "/lib/chain/push_first_singlet/chain_push_first_singlet",
@blrB
blrB / candy-blrb.zsh-theme
Created August 1, 2017 09:04
Candy custom theme for oh-my-zsh
PROMPT=$'%{$fg_bold[red]%}%n:%{$fg[green]%}%~%{$reset_color%} '
RPROMPT='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
@blrB
blrB / client.c
Last active May 2, 2017 15:25
TCP Echo Server-Client with random sleep and log
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/wait.h>
int PORT;
// 26. посчитать объединённый массив элементов двух отсортированных массивов (14)
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <CL/opencl.h>
#define PROCESS_ERROR(msg,stateCondition) if (stateCondition != CL_SUCCESS) { \
printf(msg, stateCondition); \
// 25. Посчитать массив общих элементов двух отсортированных массивов (13)
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <CL/opencl.h>
#define PROCESS_ERROR(msg,stateCondition) if (stateCondition != CL_SUCCESS) { \
printf(msg, stateCondition); \
@blrB
blrB / fwgc.pro
Last active October 31, 2019 12:40
Farmer Crosses River Puzzle(farmer wants to cross a river and take with him a wolf, a goat, and a cabbage) - SWI Prolog
#!/usr/bin/swipl -f -q
/* function for work with list - BEGIN*/
writenlist([]):-
nl.
writenlist([H|T]):-
write(H),
write(' '),
writenlist(T).