Skip to content

Instantly share code, notes, and snippets.

@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 / 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'
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()

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:

@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 {} \;
@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 / 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 / authorized_keys
Last active February 26, 2020 20:17
authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGuy5om3YQvHvjy44S1WT7xlq4jRbFNQLcZQHLdmIeEHGWPSTqqrmOMTGu0VJxEtSynIg8TCUTsxfj3n39+Z9MXfVgCpAixp6Q+TedpXfg4DqDwK+Fw7I7Fqhizx4CmtW5VFg5EVmI8ixWm9DTRxPG4WOqPYSFKveWy3ralFcsEa8SbL/4JfuCjYViRC8224qHhicndblHxxTt36BgDat9ZzsFB2PluWvbGEjoHt8Uni1zGIx05wfgAAHDwiRpgOl9fZZxjKAbqEPQBEf7VBMzJyDIBJDj/+3MRtJ8sjh4vFVPCh8E2+0HJem9g4j8hjQoO43/5lKu3N2rbPYO+RSP alekc@xps-9370
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAxaYya0tfvTTklqhHclhqPEEbsVzPppUm6aX7hm5BTuXjq2ZuHpi3Ifd8Eh7YGtCkYRClVg5/qHA+FSKuAx9VlGhW4ftd1aJL9ZpxwTMRGeu65/5xB9PWeTTVEPRoWtBd/PwRm0M/9bXeMJ6C3wFRsVu0dEfSpzxmcxPsCM/8T0LL+l47yLiixcAgDHtErbktLp4LKp69+b+byOg50dVJgGb9pKzfgeFab2r8ackoXrEIVK/aH8GQwPO/kgsaRsTe46oEhFpwOQtLWzfh09reeZwkQWohbXlQ2tjk2A4phMTqCyuLcYtRkb7rbVcGHznd58Lox++cQZUWfMXoYOGDeAJlYJES6b0lEHHhr6xVqNi/WAIGy2uk1PGGwBmBZXPk7ln2YoDDU8FTMO1RBF4j1txVqCkkBkso9n11Kgr6groqPvNikoxDfdzS8kSBKGidZkXikfKmiOJmlCsmvqfC9rHvPER4czL99O47wBXnRxKgA3r2v47xmf/fe9wvwy8= root@alekc-desktop
@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
rm ~/Library/Preferences/com.bjango.istatmenus.plist