Skip to content

Instantly share code, notes, and snippets.

View hex128's full-sized avatar
👾

Hex hex128

👾
View GitHub Profile

Установка и конфигурация KVM (libvirt) на CentOS 7

Установка пакетов

yum -y install qemu-kvm libvirt virt-install dnsmasq

Настройка libvirt

vi /etc/polkit-1/localauthority/50-local.d/50-libvirt-wheel.pkla

0000000: 405a 5000 0060 0000 0100 3500 8002 8680 @ZP..`....5.....
0000010: 2b42 8680 0111 010d 8b03 0005 f000 4000 /B............@.
0000020: c9de 5014 0e24 3101 4b88 0024 d7a6 4d0c ..P..$1.K..$..M.
0000030: 1669 1679 1689 1699 ffff 1000 feff 0000 .i.y............
0000040: 7419 0c03 0000 0460 fdec 1003 0418 44e2 t......`......D.
0000050: cc77 2201 1469 9224 1a00 9831 6bcc 8f1f .w"..i.$...1k...
0000060: e0cf 8007 e0c1 b83f 3fff 0000 0000 2000 .......??..... .
0000070: 280a 810e 0000 0000 0000 0000 0000 0000 (...............
0000080: 0000 0000 0000 ebdb 3604 f001 4611 0000 ........6...F...
0000090: 1c77 0024 d7a6 4d0d 0400 0000 0000 5000 .w.$..M.......P.
@hex128
hex128 / ovpn-add.sh
Last active October 7, 2016 03:32
OpenVPN certificate management scripts
#!/bin/bash
name=$1
if [ -z "$name" ]
then
echo "Argument not present."
echo "Useage $0 [common name]"
exit 99
fi
echo "Generating key request for $name"
prev_dir=${PWD}
@hex128
hex128 / dovecot.conf
Last active July 30, 2016 17:28
Postfix & Dovecot
auth_mechanisms = plain login
auth_username_format = %n
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
mail_access_groups = mail
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail
passdb {
driver = pam
}
@hex128
hex128 / rtmp-stream.conf
Last active July 30, 2016 17:27
RTMP streaming daemon based on FFmpeg
# Set settings and rename to rtsp-stream.conf
# Main video stream
camera="rtsp://127.0.0.1/stream"
# ALSA sound input
alsa_i="hw:0"
# RTMP server URL
server="rtmp://a.rtmp.youtube.com/live2"
# RTMP stream name
stream="username.1234-5678-90ad-cdef"
# Video size
@hex128
hex128 / ukrpost.py
Last active July 30, 2016 17:27
ukrposhta.ua tracking script
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from sys import stdout, stderr, exit, argv
from codecs import getwriter
from signal import signal, SIGINT
from urllib import urlencode
from urllib2 import build_opener, HTTPCookieProcessor, Request
from cookielib import CookieJar
from bs4 import BeautifulSoup
@hex128
hex128 / client.c
Last active July 30, 2016 17:27
Example C TCP socket client
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int sockfd;
ssize_t n;
uint16_t portno;
@hex128
hex128 / poll.php
Last active July 30, 2016 17:26
Remote Control
<?php
$APC_KEY = "remote_command";
$now = time();
$msec = 0;
$success = false;
while (!$success && $msec < 20000) {
$command = apc_fetch($APC_KEY, $success);
usleep(1000);
$msec ++;
}
@hex128
hex128 / nodejs.service
Last active July 30, 2016 17:26
Node.JS server with SystemD socket activation
[Service]
ExecStart=/usr/bin/node /var/www/server.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs
User=www-data
Group=www-data
@hex128
hex128 / rtpdec_h264.patch
Last active July 30, 2016 17:25
Ignore invalid sprop-parameter-sets
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -168,6 +168,10 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
int ret;
+ if (value[strlen(value) - 1] == ',') {
+ av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n");
+ return 0;
+ }
codec->extradata_size = 0;
av_freep(&codec->extradata);