Skip to content

Instantly share code, notes, and snippets.

@alekc
alekc / nas.yml
Created March 2, 2020 12:08
nas
---
- hosts:
- xps-desktop
vars:
- docker_data_path: /4t/docker-data
- media_folder: /2t/media
- media_docker_path: /media
- uid: "500"
- gid: "500"
- transmission_web_host: bt.example.com
@alekc
alekc / authorized_keys
Last active November 21, 2025 20:54
authorized_keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGWXPIQtu7dXugDhGj4yI6uyCJwK7PUBP5Tl1G8iUT6A gl-macbook-2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCjeC58YivoJ4a0yG8rW6uNKHorIVM/ICwEpY7CMOfp6LNOWZy4S6iITp5MUuRnJoMW8uJBaJ+aOd+XFSDSe2wG7MOD3U2nQim4c90DxoJ+dTA2N0IqTAAsOjSCNLHaxHcqdhjzlbtOTu+uqdyT2pu9OEhGZnBgsBWBPnk+22OEu+KK6oo45P645uIiShnZFBYT6nEMWaKUEaJQn2WC2IHE8614q+wQaVKfSoLAw0Zur1cPK3vg/TFez0Pv5Onei/teJc2gfx6wC8wMs7NiB4phgRdQjAKoTiqp7CfZn5AD30PEQ4oKYBZIISOuyVzgdNZ7JuEUQuRtmlfILJlfw7ytl4YkwmLbCF+SHcv2l0CbDza/Lm279H4IEXkdZsNxgiUMgGvUEmYzLmTkxrUnZXaicMgIEhUMQz+9NWMNCjqTopQzdVcfzgw06xEQh75gtFTTuTdaOPDJCBEvE31PAPxOu9tRvQ1SukRPDDaaqVOAq8yAUVhnMhnEAg1372RO5kE= alekc@desktop-ubuntu
8doN1s+veX69uS+Ay2Y0kJgN+91MVLI01WqigvXnlxTiYZ3/dnPvA3E2W+nl8I4lE8FI+UVSDUZmgyep0zcmc7Tfl5qxTB9Ekw5qXwoSm9IWVRiadHGxB09DVFE260uVfrs1ICs5oG58wdETre+EI6FntzUfb37QSYH1AGfnkzMlX9HQtxdmWy00S8JaCQGROXtadKsObuHu0GMeLuHg+QMtgUCvq+O6C2mbfDo8MmG+t5LyPfbyZyVeZ8t5pfgOxSpt0MrHdugY046FGld8fxfw96X026C1g7045pzpD89o/LAzlnNa1/X00s35InL2mRJ+rBaubHZiquDMw+HEn5CUIGptwBLQyUoH
@alekc
alekc / gist:02fecfa5e2d8f7e9bd6ae6f21558faf4
Last active January 8, 2020 17:53
Resolve chef key was 257 bytes (Expected 32)

if you encounter a followig error:

key was 257 bytes (Expected 32)

it's possible to fix it with

ssh-add
@alekc
alekc / docker_container_snippet.yaml
Created October 30, 2019 09:34
Live template for ansible docker_container
docker_container:
name: undefined # string- required. Assign a name to a new container or match an existing container.,When identifying an existing container name may be a name or a long or short container ID.
image: undefined # string- not required. Repository path and tag used to create the container. If an image is not found or pull is true, the image will be pulled from the registry. If no tag is included, 'latest' will be used.
api_version: auto # string - not required. The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by docker-py.,If the value is not specified in the task, the value of environment variable C(DOCKER_API_VERSION) will be used instead. If the environment variable is not set, the default value will be used.
auto_remove: no # boolean - not required. enable auto-removal of the container on daemon side when the container's process exits
blkio_weight: undefined # not required. Block IO (relative weight), between 10 and 1000.
@alekc
alekc / clean-old-backups.sh
Last active October 20, 2019 15:44
Clean old backups.
#!/bin/bash
find /mysql-backup/archive -maxdepth 1 -mindepth 1 -type d -ctime +15 -exec rm -rf {} \;

Keybase proof

I hereby claim:

  • I am alekc on github.
  • I am alekcander (https://keybase.io/alekcander) on keybase.
  • I have a public key ASBrJQ3ywj34xakKCbL_baAHxmXeMzeWN48h0PtUHEdNuQo

To claim this, I am signing this object:

func TestGetEntryByID(t *testing.T) {
req, err := http.NewRequest("GET", "/entry", nil)
if err != nil {
t.Fatal(err)
}
q := req.URL.Query()
q.Add("id", "1")
req.URL.RawQuery = q.Encode()
rr := httptest.NewRecorder()
@alekc
alekc / gist:3f59cd5c58305f7e5e7ff94d8d1a7816
Created August 15, 2019 06:55
Using curl for testing apps behind load-balancers
curl --verbose --header 'Host: www.example.com' 'http://10.1.1.36:8000/the_url_to_test'
@alekc
alekc / remove click_under.js
Created May 14, 2019 09:40
tampermonkey remove click under js.
Object.defineProperty(navigator, "userAgent", {value: 'fake browser'});
// ==UserScript==
// @name prevent pop-ad
// @include http://animeflv.net/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
@alekc
alekc / install-firehol-netdata.sh
Last active March 7, 2020 16:02
Install firehol and netdata.
#!/bin/bash
# You can also run this script with 1 line
# curl https://gist.githubusercontent.com/alekc/dcbf3a6e0d76560023fb08a6aa58d02c/raw/install-firehol-netdata.sh | bash
LC_ALL=C
# you need to install a basic build environment
# this is for ubuntu, change it according to your needs for other systems
apt-get update && apt-get install -y zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autogen automake pkg-config traceroute ipset curl nodejs zip unzip jq ulogd2 autoconf-archive || exit 1
for x in iprange firehol netdata