Skip to content

Instantly share code, notes, and snippets.

View vkoloss's full-sized avatar

Vladislav Kolosnicin vkoloss

  • Belarus
View GitHub Profile
@vkoloss
vkoloss / clone-ubuntu.sh
Created May 7, 2021 20:59
clone-ubuntu.sh
#!/bin/bash
# NAME: clone-ubuntu.sh
# PATH: /usr/local/bin
# DESC: Written for AU Q&A: https://askubuntu.com/questions/1028604/bash-seemless-safe-script-to-upgrade-16-04-to-18-04/1028605#1028605
# DATE: Apr 27, 2018. Modified May 6, 2018.
# UPDT: May 02 2018 - Display selected parition and get confirmation.
# May 06 2018 - Revise `do-release-upgrade -d` instructions.
# Correct listing of files in empty target partition.
@vkoloss
vkoloss / node_debian_init.sh
Created July 31, 2017 20:13 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@vkoloss
vkoloss / start-stop-daemon-example.sh
Last active December 31, 2017 11:23 — forked from alobato/start-stop-example.sh
start-stop-daemon-example
#!/bin/bash
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
NAME=app
DIR=/home/username/app/bin
PIDFILE=/var/run/$NAME.pid
DAEMON=/home/username/app/bin/executable
DAEMON_ARGS="-foo bar"
@vkoloss
vkoloss / mh_z19.py
Created December 26, 2016 08:58 — forked from UedaTakeyuki/gist:bfe8b20c80e6f09c7105
MH-Z19 CO2 Sensor reading.
# http://eleparts.co.kr/data/design/product_file/SENSOR/gas/MH-Z19_CO2%20Manual%20V2.pdf
# http://qiita.com/UedaTakeyuki/items/c5226960a7328155635f
import serial
import time
def mh_z19():
ser = serial.Serial('/dev/ttyAMA0',
baudrate=9600,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
#!/bin/bash
jtl="file.jtl"
total=$(wc -l < $jtl)
let "total -= 1"
for i in $(cut -f 4 -d , $jtl | sort | uniq | egrep "[0-9]")
do
count=$(cut -f 4 -d , $jtl | grep $i | wc -l)
rate=$(echo "scale=2; 100 * $count / $total" | bc)
import groovy.transform.EqualsAndHashCode
@EqualsAndHashCode(includeFields=true)
public class Person {
String name;
String lastName;
@Delegate
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Person {
private String name;
private String lastName;
class WorkingDay {
def schedule = []
WorkingDay() {
def mc = new ExpandoMetaClass(WorkingDay, false, true)
mc.initialize()
this.metaClass = mc
}