Skip to content

Instantly share code, notes, and snippets.

@ahmpro
ahmpro / haproxy.cfg
Created September 8, 2017 16:41 — forked from arkady-emelyanov/haproxy.cfg
haproxy check: postgresql is master
# Sample haproxy postgresql master check
#
# haproxy listen: 5431
# pg, instance #1 listen: 5432 (master node)
# pg, instance #2 listen: 5433 (replica node)
# external failover, promoting replica to master in case of failure
# passwordless auth for user web
# template1 database is accessible by user web
#
# haproxy will pass connection to postgresql master node:
@ahmpro
ahmpro / ya.ddns.sh
Last active September 12, 2021 12:31
Yandex dDNS handmade for OpenWrt
#!/bin/bash
# Author: ahmpro and community
# gist url: https://gist.github.com/ahmpro/f1fceddf1ac62d60980d
# Yandex dDNS(handmade Dynamic DNS) for OpenWrt
# Tested on OpenWrt Chaos Calmer r46612, LuCI (git-15.216.69575-bb7ea3e)
# You should install curl (don't forget update packages list)
# Get __TOKEN__: https://pddimp.yandex.ru/api2/admin/get_token
@ahmpro
ahmpro / bootstrap.yml
Last active September 8, 2015 12:05
ahmpro ansible bootstrap
---
# usage: ansible-playbook -i '8.8.8.8,' bootstrap.yml
# oneline, for easy bootstrap, do not forget change ip and user :)
# wget https://gist.githubusercontent.com/ahmpro/57cca91f1a298b1adaa9/raw/bootstrap.yml -O /tmp/ahmpro_bootstrap.yml && ansible-playbook -i '8.8.8.8,' /tmp/ahmpro_bootstrap.yml -u root
- hosts: all
become: yes
become_user: root
handlers:
- name: restart ssh
service: name=sshd state=restarted
@ahmpro
ahmpro / habr.htm
Last active August 29, 2015 14:07
Хабрахабр — профилактика
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Хабрахабр / Профилактические работы</title>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
<style>
@font-face {
font-family: 'PT Sans';
font-style: normal;
@ahmpro
ahmpro / Makefile
Last active August 29, 2015 14:02
Sobel filter with threads - lab 5 on "Operating Systems" in MAI
all:
gcc -Wall -lm -lpthread -std=gnu99 sobel.c -o sobel
clean:
rm sobel
rm edgemap_sobel.pgm
rm work.txt
rm table.txt
rm letsrock.pgm
check:
cppcheck --enable=all --inconclusive --std=posix sobel.c
@ahmpro
ahmpro / Makefile
Last active August 29, 2015 14:01
gamma - lab 4 on "Operating Systems" in MAI
all:
gcc -Wall -std=gnu99 gamma.c -o gamma
gcc -Wall -std=gnu99 input.c -o input
gcc -Wall -std=gnu99 encoder.c -o encoder
clean:
rm gamma
rm input
rm encoder
rm gamma.txt
rm text.txt
@ahmpro
ahmpro / Makefile
Last active August 29, 2015 14:01
terminal emulator - lab 3 on "Operating Systems" in MAI
all:
gcc -Wall -std=gnu99 zhell.c -o zhell
clean:
rm zhell
@ahmpro
ahmpro / zupper.c
Created March 19, 2014 17:43
Simple file archiver. Make for lab in MAI(Russia).
/*
* File: zupper.c
* Copyright 2014 L1S & ahmpro
*/
#include <stdio.h>
#include <dirent.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
@ahmpro
ahmpro / chip test ir11.py
Last active December 17, 2015 02:48
Generator tests for chip (ИР11). МАИ. Кафедра 307.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Short desc: Generator tests for chip (ИР11)
# Author: ahmpro
# Created: 18.04.2013
#-------------------------------------------------------------------------------
class IR11:
@ahmpro
ahmpro / division_6.mcl
Created May 4, 2013 10:58
Right division on MCL. (MAI 2013)
writeln "division_6.mcl running";
REG RA[8], RB[8], R1[8], R2[8], R3[8], RC[8];
REG SCH[8], TZ[1], SM[8];
REG INPA[16], INPB[16];
START:
write "A = "; read INPA;
write "B = "; read INPB;
TZ := INPA[15..15] XOR INPB[15..15];