Skip to content

Instantly share code, notes, and snippets.

# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "login"
:local noippass "password"
# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
@dukelion
dukelion / import-cert.sh
Last active August 29, 2015 14:17
import self-signed https to chrome
#!/bin/sh
#
# usage: import-cert remote.host.name [port]
#
REMHOST=$(echo $1 | sed -re 's@http(s)?://([^/]*).*@\2@')
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "$REMHOST" -i $REMHOST
@dukelion
dukelion / mysql_copy.py
Last active August 29, 2015 14:22
A script for mysql database quick-and dirty cloning
#!/usr/bin/python
import sys, argparse
import mysql.connector
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("--target", required=True, help="Target db name")
parser.add_argument("--template", default="template", help="Source template db name")
args = parser.parse_args()
whois ts.kg
% This is the .kg ccTLD Whois server
% Register your own domain at http://www.domain.kg
Domain TS.KG
Administrative Contact:
PID: 10613-KG
Name: Фейдман А.В.
Email: [email protected]
$r = mysql_query("SELECT count(*) FROM user");
$d = mysql_fetch_row($r);
$rand = mt_rand(0,$d[0] - 1);
$r = mysql_query("SELECT username FROM user LIMIT $rand, 1");
@dukelion
dukelion / gist:f6263bd164afa1ca6631
Created December 8, 2015 12:26
job description
[6:13:38 PM] Vadim Glebov: У нас есть один клиент в Израиле и он хочет часть своих задач переложить на другого специалиста, чтобы освободить время для бизнеса, вот что он пишет:
In our company we're 6 people sitting in the office. The problem is that I am the only technical person. So at least 50% of my time is going on IT support.
I do stuff like cloning databases, writing fast scripts for WP, coding automation scripts and other stuff like that. Anyway, those are all really simple tasks so we decided to hire someone for that position. I think it's called DevOps.
Here are the responsibilities for this position:
* Priority 1 (20% of the time):
* Give technical support with JS, HTML, CSS, PHP
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/wiki.iron.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wiki.iron.io/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/wiki.iron.io/fullchain.pem;
ssl_dhparam /etc/ssl/private/dhparam.key;
ssl_session_timeout 24h;
ssl_session_cache shared:SSL:10m;
ssl_stapling on;
ssl_stapling_verify on;
### Keybase proof
I hereby claim:
* I am dukelion on github.
* I am dukelion (https://keybase.io/dukelion) on keybase.
* I have a public key whose fingerprint is CEB5 ED18 CC1C EFD8 9500 DF05 886C 160F FBDA 45A9
To claim this, I am signing this object:
@dukelion
dukelion / Dockerfile
Created September 15, 2017 08:23
Rocksdb tools image
# docker-rocksdb
Alpine Linux image with compiled and installed RocksDB with all compression libraries
dukelion@x1-carbon:~/source/docker-rocksdb$ cat Dockerfile
FROM golang:1.8-alpine
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >>/etc/apk/repositories && \
echo "@community http://nl.alpinelinux.org/alpine/edge/community" >>/etc/apk/repositories
RUN apk add --update --no-cache build-base linux-headers git cmake bash #wget mercurial g++ autoconf libgflags-dev cmake bash jemalloc perl
RUN apk add --update --no-cache zlib zlib-dev bzip2 bzip2-dev snappy snappy-dev lz4 lz4-dev zstd@community zstd-dev@community jemalloc jemalloc-dev libtbb-dev@testing libtbb@testing
@dukelion
dukelion / set-elb-access-logs.py
Last active March 13, 2018 08:01
Make sure ELB access logs enabled for MQ
#!/usr/bin/env python
import boto3
from os import getenv
region = getenv('AWS_REGION','us-east-1')
ec2 = boto3.client('elbv2', region_name=region)
response = ec2.describe_load_balancers()
grepAccessLogParam = lambda x: x['Key'] == 'access_logs.s3.enabled'
grepAccessLogBucket = lambda x: x['Key'] == 'access_logs.s3.bucket'