Skip to content

Instantly share code, notes, and snippets.

View islander's full-sized avatar

kiba islander

  • Innova Distribution
  • Moscow | Saint Petersburg
View GitHub Profile
@islander
islander / cidr.py
Created June 27, 2018 04:34 — forked from toringe/cidr.py
Merge CIDR blocks into super blocks if possible
#!/usr/bin/env python
#
# Example 1: All blocks in list.txt, one CIDR per line
# cat list.txt | cidr.py
#
# Example 2: Echo CIDR blocks to stdout
# echo 1.2.3.0/25 1.2.3.128/25 | cidr.py
import sys
from netaddr import *
@islander
islander / rename_volume_group.sh
Created June 21, 2018 04:34
Rename LVM Volume Group
#!/bin/bash
# Rename LVM Volume Group
# (c)https://askubuntu.com/a/900532
# Must be run with root permissions
# sudo will be sufficient
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
@islander
islander / i18n
Created May 28, 2018 03:55
Русский язык в консоли CentOS Linux
# /etc/sysconfig/i18n
LANG="ru_RU.UTF-8"
SUPPORTED="ru_RU.UTF-8:ru_RU:ru"
SYSFONT="latarcyrheb-sun16"
@islander
islander / fsck_qcow2.md
Last active June 8, 2024 07:42
Recover a qcow2 image using fsck

Recover a qcow2 image using fsck

Load network block device module:

# modprobe nbd max_part=8

Poweroff machine:

# virsh destroy virtual-machine

@islander
islander / gnome_ru_locale.sh
Created March 8, 2018 00:11
Set gnome ru_RU.UTF-8 locale
gsettings get org.gnome.system.locale region
gsettings set org.gnome.system.locale region 'ru_RU.UTF-8'
@islander
islander / source_code_pro_font_install.sh
Created October 25, 2017 00:41
install Source Code Pro font
#!/bin/bash
set -euo pipefail
I1FS=$'\n\t'
mkdir -p /tmp/adodefont
cd /tmp/adodefont
wget -q --show-progress -O source-code-pro.zip https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip -q source-code-pro.zip -d source-code-pro
mkdir -p ~/.fonts
cp -v source-code-pro/*/OTF/*.otf ~/.fonts/
@islander
islander / extensions.lua
Created October 20, 2017 03:21 — forked from igmar/extensions.lua
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
@islander
islander / unicode.cnf
Created September 21, 2017 06:39
MySQL/MariaDB unicode configuration
# place in /etc/mysql/conf.d/
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
@islander
islander / mysql_routines.sh
Last active August 29, 2017 22:58
Save MySQL functions, procedures and triggres
#!/bin/sh
# Save MySQL functions, procedures and triggres
DBNAME=$1
DUMPFILE=/var/backup/mysql/$DBNAME/routines.sql
mkdir -p /var/backup/mysql/$DBNAME/
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt $DBNAME > $DUMPFILE
@islander
islander / mongodb_memory_limit_ubuntu1404.sh
Created June 13, 2017 00:27
Limiting MongoDB memory usage with cgroups on Ubuntu 14.04
#!/usr/bin/env bash
# http://brainsuckerna.blogspot.com/2016/05/limiting-mongodb-memory-usage-with.html
# (c) Miadzvedz Mikalai, 2016. brainsucker.na at gmail.com
# init scripts (c) frank2, see http://frank2.net/cgroups-ubuntu-14-04/ for description and details
# more info (no init scripts): using cgroups to limit DB memory https://www.percona.com/blog/2015/07/01/using-cgroups-to-limit-mysql-and-mongodb-memory-usage/
#
# execute from shell:
# sudo bash -c 'curl -o- http://brains.by/misc/mongodb_memory_limit_ubuntu1404.sh | bash'
{ # this ensures the entire script is downloaded #