Skip to content

Instantly share code, notes, and snippets.

View kksudo's full-sized avatar
:octocat:
Software is like sex: It’s better when it’s free.

Kirill kksudo

:octocat:
Software is like sex: It’s better when it’s free.
View GitHub Profile
#!/bin/sh
# ./convert_ploop_to_simfs.sh VEID
# chmod +x convert_ploop_to_simfs.sh
rsync_options='-aHAX --progress --stats --numeric-ids --delete'
partition='vz'
if [ ! -e /etc/vz/conf/$1.conf ]; then
echo "Virtual server configuration file: /etc/vz/conf/$1.conf does not exist."
exit 1
fi
if [ ! -d /$partition/private/$1/root.hdd ]; then
@kksudo
kksudo / ipaddr_demo.rb
Last active August 29, 2015 14:25 — forked from Lax/ipaddr_demo.rb
Ruby IPAddr class, inet_aton and inet_ntoa equivalence.
require 'ipaddr'
IPAddr.new("192.168.0.1").to_i
=> 3232235521
IPAddr.new(3232235521, Socket::AF_INET).to_s
=> "192.168.0.1"
@kksudo
kksudo / Dockerfile
Created December 25, 2019 10:06
emqtt_bench v.0.3.1
FROM erlang:22-alpine
# install packages
RUN apk update && apk add --no-cache \
bash \
bc \
g++ \
git \
make \
musl-dev \
@kksudo
kksudo / regen.sh
Last active July 29, 2020 17:27
Regenerate keys for the salt on the minion
#!/usr/bin/env bash
systemctl stop salt-minion
rm -f /etc/salt/pki/minion/minion.pem
rm -f /etc/salt/pki/minion/minion.pub
cp -f /dev/null /etc/salt/minion_id
systemctl enable salt-minion
systemctl start salt-minion
@kksudo
kksudo / test.sh
Created July 29, 2020 17:29
demo
#!/usr/bin/env bash
echo "Hello, today is $(date)"
@kksudo
kksudo / k8s-bookmarks-CKA-CKAD.html
Created April 11, 2021 19:46
A useful kubernetes bookmarks || Certified Kubernetes Application (CKA): ProTips to pass exam 2021
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1616427741" LAST_MODIFIED="1617895617" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DT><H3 ADD_DATE="1616428159" LAST_MODIFIED="1616428159">CKA special</H3>
@kksudo
kksudo / CKA-table-list-questions
Last active June 23, 2021 11:24
A predefined list table with all questions (16-20), useful to pass the CKA exam
#| weight | total score | correct (+ or -)
1 6 6 | +
2 3 9 | -
3 3 12 |
4 3 15 |
5 6 21 |
6 6 27 |
7 3 30 |
8 3 33 |
9 6 39 |
@kksudo
kksudo / fix-salt-keys.sh
Created September 23, 2021 15:19
FIx the salt minion, when the master key on the salt-master changed
#!/bin/bash
invoke-rc.d salt-minion stop && \
rm -rf /etc/salt/pki/* && \
invoke-rc.d salt-minion start
printf "\nminion %s restarted\n" $(cat /etc/salt/minion_id)
@kksudo
kksudo / iam.tf
Created November 29, 2021 14:28
SkillFactory, a task solution ECS with EC2. Getting started with the classic console using Amazon EC2
# This role has a trust relationship which allows
# to assume the role of ec2
resource "aws_iam_role" "ecs" {
name = "${var.appName}_ecs_${var.environ}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
@kksudo
kksudo / certificate_synthetic.js
Created April 7, 2022 15:15 — forked from adamcrews/certificate_synthetic.js
New Relic SSL/TLS Synthetic
/*
To use this synthetic, set the following Secure credentials:
NEW_RELIC_INSIGHTS_API_KEY - Your api key from the account settings.
NEW_RELIC_ACCOUNT_ID - Your account ID, also found in the account settings.
CERTS_TO_MONITOR - A list of hosts to check via https, separated by a comma and a space, for example:
host.example.com, foo.example.com
Create a new Synthetic monitor, copy the entire contents of this script to the monitor.
Set the monitor to run once a day from a single location.