Skip to content

Instantly share code, notes, and snippets.

@layoaster
layoaster / rand_cursor.py
Last active August 2, 2023 11:58
Cursor randomizer
from random import randint
from time import sleep
import pyautogui
screen_resolution = pyautogui.size()
while True:
x = randint(0, screen_resolution[0] - 1)
@layoaster
layoaster / _docker
Created June 14, 2023 13:10
docker zsh completions
#compdef docker
compdef _docker docker
# zsh completion for docker -*- shell-script -*-
__docker_debug()
{
local file="$BASH_COMP_DEBUG_FILE"
if [[ -n ${file} ]]; then
echo "$*" >> "${file}"
@layoaster
layoaster / druid-metrics-config.yaml
Last active April 28, 2023 08:32
Druid Metrrics config
common.runtime.properties: |
# Monitoring metrics
druid.monitoring.monitors=["org.apache.druid.java.util.metrics.JvmMonitor", "org.apache.druid.java.util.metrics.JvmCpuMonitor", "org.apache.druid.java.util.metrics.JvmThreadsMonitor"]
druid.monitoring.emissionPeriod=PT10S
# Metrics emitters
# Composing Emitter
druid.emitter=composing
druid.emitter.composing.emitters=["http", "prometheus"]
"""
This module introduces environment variables configuration fetcher class-level support.
"""
import os
class Value(object):
"""
Defines a value that has to be potentially fetched from the variable environment.
"""
@layoaster
layoaster / api_request_wrapper.py
Created February 4, 2020 13:50
Sample of a wrapper to consum a REST API with retry logic
"""
This module provides with a high-level Planhat REST API interface. The API is
documented on `Planhat Docs <https://docs.planhat.com/>`_.
"""
import logging
from typing import Any, Dict, List, Union
import backoff
import requests
@layoaster
layoaster / pass-getting-started.md
Last active November 21, 2023 23:37
Cheat sheet/ getting-started guide to pass

pass cheat sheet/guide

Getting started guide to the unix password manager pass. Manage gpg encripted passwords (files) in a standar directory-like hierarchy. Such files can be copied or stored in a git repository.

Requirements

  1. Install [pass][pass-homepage] (standard unix password manager):

Ubuntu/Debian:

$ sudo apt-get install pass
@layoaster
layoaster / cloudSettings
Last active June 5, 2020 15:22
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-06-05T15:21:59.771Z","extensionVersion":"v3.4.3"}
@layoaster
layoaster / shakespeare_stats.py
Created October 23, 2018 13:38
Shakespeare's word frecuencies
#!/usr/bin/env python
# Extract word frequencies out of three shakespeare pieces.
# The following is assumed:
# * No word stemming.
# * Hyphenated compound words are indexed as s single word.
# * Script's characters or titles are not indexed.
# * Script comments within square brackets are indexed.
#
# Usage: