Skip to content

Instantly share code, notes, and snippets.

@matthewbednarski
matthewbednarski / postal-codes.json
Last active May 25, 2023 12:38
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$" }, { "Note":
@Dhertz
Dhertz / Ubuntu_Aerial.md
Last active March 28, 2023 02:06
Quick overview of how to get Apple's new TV screensavers working on most linux systems.

Using Apple’s Aerial Screensavers on Ubuntu After coming across the [Aerial] (https://github.com/JohnCoates/Aerial) screensavers for Mac, and installing them, I decided that I had had enough of the graphics-demos of my Ubuntu Precise system. I hope to provide a simple guide on how to add them to your setup as well.

First, you need to install xscreensaver (for example with aptitude, but your distro should have it):

sudo aptitude install xscreensaver
@ecampidoglio
ecampidoglio / cpustatus.sh
Created February 21, 2013 23:42
A Bash script that prints the current state of the CPU on a Raspberry Pi. It displays variables like temperature, voltage and speed.
#!/bin/bash
# cpustatus
#
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
@juanje
juanje / gist:3797297
Created September 28, 2012 00:38
Mount apt cache of a Vagrant box in the host to spin up the packages installation

This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.

I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.

def local_cache(basebox_name)
  cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)
  partial_dir = cache_dir.join('partial')
  partial_dir.mkdir unless partial_dir.exist?
 cache_dir
Prerequisites
=============
- One Pinephone braveheart edition
- A micro SIM card or Nano sim with micro adapter
- A micro SD card (tested with SanDisk Ultra microSDXC UHS-1 64G)
- A 5V power adapter with regular usb connector (15 Watts recommended. 5V/3 amp)
- A Linux desktop/laptop to prepare the SD card (laptop used in this tutorial)
Preparation
@kwharrigan
kwharrigan / mks_git_checkpoints.py
Created April 12, 2012 16:50
MKS fast-import script for git
#!/usr/bin/python
#Copyright (c) 2012 Kyle Harrigan
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
@hvanderlaan
hvanderlaan / ansible-vault.md
Last active August 31, 2021 12:57
Ansible-vault example

Ansible vault example

New in Ansible 1.5, “Vault” is a feature of ansible that allows keeping sensitive data such as passwords or keys in encrypted files, rather than as plaintext in your playbooks or roles. These vault files can then be distributed or placed in source control. To enable this feature, a command line tool, ansible-vault is used to edit files, and a command line flag –ask-vault-pass or –vault-password-file is used. Alternately, you may specify the location of a password file or command Ansible to always prompt for the password in your ansible.cfg file. These options require no command line flag usage.

Requirements

@onedr0p
onedr0p / starship.toml
Last active January 29, 2021 14:40
starship.toml
add_newline = true
prompt_order = ["username", "kubernetes", "directory", "git_branch", "git_status", "character"]
[character]
symbol = "\n(∩`-´)⊃ "
error_symbol = "\n(ง •̀_•́)ง "
style_success = "bold green"
use_symbol_for_status = true
[username]
@rsvp
rsvp / netspeed.sh
Last active May 13, 2020 15:08
netspeed.sh : check download speed rate via command line | Linux bash script
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2013-07-11
#
# _______________| netspeed : check download speed via command line.
#
# Usage: netspeed [tokyo, london, usw, use, east, west, URL]
# ^default U.S. west coast.
# [ -speed_KB/sec ]
# ^negation activates the Mbps converter.
#
@tahoward
tahoward / container_config.yml
Last active March 25, 2019 18:34
Home Lab CoreOS Ignition
passwd:
users:
- name: core
password_hash: "$6$wXQZxh8d0BU4Eg$lVJQdLN08erJvBBgA0kS30yq5x8.gx1VKffmtjtD2GAgRdAzcpn1xO.3alXeOvSX92L72pGmx1EnSUTJvomLy1"
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAgEA1AJonpQaUOGKJKY/EOBOaMGYaHDdI6WPOLtVPgcmJhG/lb7lAT+YbUdn/7xAz0dbJhAh2XlJK++LQehhw4q7MnJ5ckgS5yoCx2VkJY//56T/Gv+q1cAxBcsq/5CF8rj8+cNR1Ztpf2Kq3gKZTdhvOytBjr7mh3Ui8bAMGBMf/KYWLbPCTybEam9BbyZeM5edf9N6q4vKSsx1SbpAOGEdnDjz2ttEJ8aaCWDvFbYOzjJwlgVXhRtbUvkjuct3/d72OpBRBhY0jlzwh4LSK1WGD6TbWOpZZP+RxvUTiKAGaMufmc6VKuN+jQQdxodyq9p/1DT8O9gspgolfVQpV0n7Lg+/FtGEh7Aq/eOB0VIRA7FCrvk38q4EZIatS7QaqdreIRtOUjCiu8EyOlnRuI5Ow7qIqWyAcZC9b5yi+q0LHuuDujmxBu9OdXPjZzj9EZl9OfPeHrhbNoRun6+CsRtBRh2rTjf2lPU5H0MLFZ3bZKNMxgnyxqoHQKCfim+4b1TTdv6Bengr4hN28IxIWW35vEBd0I1TQ6TKjOnvR3evjuHYefEtdAJqSo0QrKfPwzdL57VELre7JaCe4qZocTcCxOu/1hrkhlT1bX3QguB9/PL/m+kh7dEneajs6sVi3ewGXch9Sa3qEwKuiCisC6zumDQMcn+9VoYqXlr8igaziZ8= rsa-key-20180428"
storage:
files:
- filesystem: root
path: /etc/hostname