Skip to content

Instantly share code, notes, and snippets.

@bykvaadm
bykvaadm / sentry.py
Created June 4, 2018 08:58 — forked from fliphess/sentry.py
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@kokumura
kokumura / lineinfile.sh
Created May 25, 2018 08:39
lineinfile in Shell Script
# Ansible 'lineinfile' like function in Shell Script.
# Works on both Bash and Zsh.
function lineinfile(){
if [[ $# != 3 ]];then
local THIS_FUNC_NAME="${funcstack[1]-}${FUNCNAME[0]-}"
echo "$THIS_FUNC_NAME - 3 arguments are expected. given $#. args=[$@]" >&2
echo "usage: $THIS_FUNC_NAME PATTERN LINE FILE" >&2
return 1
fi
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3YsqKzVhYGRzBNbP2dOeEmdr/b8OmC/XgSFA8wjhyyY+K5dWPELRJQT5mZs11V/ntrjUB/O18tjb9rAqQsE4mOUUu8rGZf4lrXULxu2LkmQc4gXKX6LssanUugUk4XbatX8pFKsq5P51nHoyfJ0p0uFLvEcWl32r2HPD/ThfR0jaiNDtp4cUu1YD0aJjQuMhsnZLyl8GFc9qFgKTit0OdcGauYbDEUR+2w4MuUrwTBiVhKyGyhj86KVqNbNtopWDWfp4S6sBQtbog7aQ0dhErNDK79qaJrlywRsdFdLqp76a4GGfGdSdBhQZWCqjpfKrPchhjfZCo75efF/LXdm0V /home/alexkuklin/.ssh/id_rsa
@swisslala
swisslala / docker-compose.yml
Created February 14, 2018 02:32 — forked from osadalakmal/docker-compose.yml
docker compose file for bringing up a HA vault cluster with one active server and two standby servers.
version: '2'
networks:
consul_net:
driver: bridge
ipam:
driver: default
config:
-
subnet: 172.16.238.0/24
@deoren
deoren / Ubuntu_on_Hyper-V.md
Last active May 8, 2023 11:01
Ubuntu on Hyper-V

Enabling full Hyper-V support for Ubuntu

Install packages

Short version: See docs.microsoft.com link below.

Ubuntu 17.04 and later

  1. sudo apt-get update
  2. sudo apt-get install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual
#!/usr/bin/perl
package World::Schema;
use base qw/DBIx::Class::Schema::Loader/;
$ENV{SCHEMA_LOADER_BACKCOMPAT} = 1;
my $schema = World::Schema->connect("DBI:mysql:database=world", "world", "world1",
{PrintError => 1, RaiseError => 1, mysql_enable_utf8 => 1});
package main;
use DBIx::Connector;
use DBIx::Struct;
@mttjohnson
mttjohnson / mysql-performance-tuning.sql
Last active August 23, 2024 17:54
MySQL Performance Tuning
-- Query the database to calculate a recommended innodb_buffer_pool_size
-- and get the currently configured value
-- The rollup as the bottom row gives the total for all DBs on the server, where each other row is recommendations per DB.
SELECT
TABLE_SCHEMA,
CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size,
(
SELECT CONCAT(CEILING(variable_value/POWER(1024,FLOOR(LOG(variable_value)/LOG(1024)))),SUBSTR(' KMGT',FLOOR(LOG(variable_value)/LOG(1024))+1,1))
@ultim8k
ultim8k / vim-multiline-comment.md
Last active August 11, 2025 08:56
(un) comment multiple lines vim

From: http://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim

For those tasks I use most of the time block selection.

Put your cursor on the first # character, press Ctrl``V (or Ctrl``Q for gVim), and go down until the last commented line and press x, that will delete all the # characters vertically.

For commenting a block of text is almost the same: First, go to the first line you want to comment, press Ctrl``V, and select until the last line. Second, press Shift``I``#``Esc (then give it a second), and it will insert a # character on all selected lines. For the stripped-down version of vim shipped with debian/ubuntu by default, type : s/^/# in the second step instead.

@denji
denji / linux-mem-swap-cache-flush.sh
Last active August 11, 2020 22:15
fincore [options] files... Flush Linux pagecache, dentrie & inode (cache) + reswaping 0B
#!/usr/bin/sh
# Flush Linux pagecache, dentrie & inode (cache)
# Reswaping 0B
MIN_MEMORY=78643200 # Reswap only if there is free RAM (75MB)
#PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
#PATH=/bin:/sbin:$PATH
# Flush pagecache + reswaping 0B:
#!/usr/bin/perl
use Benchmark qw(:all);
use Storable;
use Clone;
use CBOR::XS;
use Data::MessagePack;
use Panda::Lib;
use Sereal;
use Sereal::Dclone;