Skip to content

Instantly share code, notes, and snippets.

View unref's full-sized avatar

Nikolay G unref

  • saint-petersburg, russia
View GitHub Profile
@unref
unref / avr_atmega8_pwm_full_software.c
Created January 7, 2023 13:25
full software avr atmega 8 pwm
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define LED_PORT PORTB
#define LED_DDR DDRB
#define LED_DELAY 20
@unref
unref / samba-lxc-restart.sh
Created May 18, 2022 17:07
simple shell script to restart lxc container
#!/bin/sh
###
# description: stop and then start lxc container
# author: unref (unref@inbox.ru)
# date: 18-05-2022
# license: MIT
###
###
@unref
unref / m3u8-to-mp4.md
Created January 31, 2021 16:11 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@unref
unref / start-dev.service
Created January 19, 2019 05:10
systemd service that start and stops group of service, this can be useful for web development for example
[Unit]
Description=Start web dev environment
Requires=nginx.service php-fpm.service mariadb.service
[Service]
ExecStop=systemctl stop nginx.service php-fpm.service mariadb.service
RemainAfterExit=yes
@unref
unref / flask.conf
Created January 29, 2018 23:10
Simple flask alpine linux init script config
FLASK_CONFIG="production"
HOST="0.0.0.0"
OPTS="runserver -h $HOST"
PYTHON_BIN="/srv/flask/.env/bin/python"
SCRIPT_FILE="/srv/flask/manage.py"
@unref
unref / flask.init
Created January 29, 2018 23:08
Simple flask alpine linux init script file
#!/sbin/openrc-run
name=$RC_SVCNAME
command="$PYTHON_BIN"
command_args="$SCRIPT_FILE $OPTS"
command_background="yes"
command_user="nobody"
pidfile="/run/$RC_SVCNAME.pid"
@unref
unref / flask-init.sh
Created January 17, 2018 10:14
bash script to create flask template
#!/bin/sh
if [ ! -z $1 ]; then
APPNAME=$1;
else
echo -n "Enter application directory: "
read APPNAME
fi
if [ ! -z $APPNAME ];
@unref
unref / promise-series.js
Last active January 29, 2018 23:19
Promise.series - static method to invoke function in series
Promise.series = function series(data, fn) {
const results = [];
return data.reduce((promise, current) => {
return promise
.then(() => fn(current))
.then(result => { results.push(result); });
}, Promise.resolve())
.then(() => results)
.catch(err => Promise.reject(err));
@unref
unref / convert.sh
Created September 29, 2017 15:26
convert video file from 1080p and greater, into 720p
#!/bin/sh
##
# finds file by file type
# convert video file from 1080p and greater, into 720p
# License: MIT
# author: nixso, post@nojs.ga
##
filetypes="mp4|avi|wmv|mkv"