Skip to content

Instantly share code, notes, and snippets.

sevkin /
Created Sep 13, 2020
конвертер контактов из яндекс почты в список для "рассылки"
import vobject
import csv
with open('abook.vcf', 'r') as abook:
with open('contacts.csv', 'w') as out:
writer = csv.writer(out)
writer.writerow(['Имя', 'Почта'])
for card in vobject.readComponents(abook):
if not hasattr(card, 'fn'):
sevkin / bootstrap.yml
Last active Dec 24, 2019
ansible bootstrap python on deb based distros
View bootstrap.yml
- hosts: all
any_errors_fatal: True
gather_facts: no
become: True
- name: test python-apt
raw: "which python && python -c \"import apt\""
ignore_errors: True
changed_when: False
failed_when: False
sevkin / Makefile
Created May 21, 2019
SSL generate without questions
View Makefile
CN :=
openssl req -nodes -newkey rsa:4096 -keyout $(CN) -noout -subj \
openssl req -new -key $(CN).key -out $(CN).csr -subj \
sevkin / getfreeport.go
Last active Jan 29, 2020
get free port in golang
View getfreeport.go
// GetFreePort asks the kernel for a free open port that is ready to use.
func GetFreePort() (port int, err error) {
var a *net.TCPAddr
if a, err = net.ResolveTCPAddr("tcp", "localhost:0"); err == nil {
var l *net.TCPListener
if l, err = net.ListenTCP("tcp", a); err == nil {
defer l.Close()
return l.Addr().(*net.TCPAddr).Port, nil
sevkin / ulimit.conf
Last active Mar 11, 2019
nginx php-fpm bitrix pcre.recursion_limit
View ulimit.conf
# mkdir /etc/systemd/system/php-fpm.service.d
# cd /etc/systemd/system/php-fpm.service.d
# vi ulimit.conf
# systemctl daemon-reload
# systemctl restart php-fpm
sevkin /
Last active Dec 8, 2018
openwrt router + usb_ether modem
# luci > net > firewall > custom_rules
# add modem (eth1) to lan bridge
# drop modem dhcp (modem is static
iptables -A input_lan_rule -p udp --src --destination-port 68 -j DROP
iptables -A forwarding_lan_rule -p udp --src --destination-port 68 -j DROP
sevkin / loader.html
Created Aug 21, 2017 — forked from bellbind/loader.html
[threejs][html5]STL File Viewer with HTML5 File API
View loader.html
<!doctype html>
<meta charset="utf-8" />
<title>STL File Viewer</title>
<script src=""
<script src=""
<script src="loader.js"></script>
sevkin / mongo-docker.bash
Created Jul 27, 2017 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
View mongo-docker.bash
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (
# add a root user
sevkin / url_open.go
Created Jul 27, 2017
open url in default browser
View url_open.go
// open opens the specified URL in the default browser of the user.
func open(url string) error {
var cmd string
var args []string
switch runtime.GOOS {
case "windows":
cmd = "cmd"
args = []string{"/c", "start"}
sevkin / dnsmasq.yml
Last active Feb 13, 2017
Install standalone dnsmasq instead of NetworkManager controlled - ansible playbook - ubuntu 16.04
View dnsmasq.yml
- hosts: localhost
connection: local
# gather_facts: no
become: yes
- interfaces: ["lo", "docker0"]
- name: install dnsmasq