Skip to content

Instantly share code, notes, and snippets.

View fnkr's full-sized avatar
🐧
cat /dev/urandom | aplay -c 2 -r 24000

Florian Kaiser fnkr

🐧
cat /dev/urandom | aplay -c 2 -r 24000
View GitHub Profile
@halberom
halberom / 00_play.yml
Last active September 6, 2022 08:03
ansible - example of parsing a url
---
- hosts: localhost
gather_facts: False
connection: local
vars:
myvar: 'http://www.example.domain.com:9090'
tasks:
- name: not as good as a custom filter
debug:
@mapmeld
mapmeld / OverEncrypt.md
Last active July 25, 2023 18:55
OverEncrypt - paranoid HTTPS

OverEncrypt

This is a guide that I wrote to improve the default security of my website https://fortran.io , which has a certificate from LetsEncrypt. I'm choosing to improve HTTPS security and transparency without consideration for legacy browser support.

WARNING: if you mess up settings, lose your certificates, or decide to no longer maintain HTTPS certs, these steps can and will make your domain inaccessible.

I would recommend these steps only if you have a specific need for information security, privacy, and trust with your users, and/or maintain a separate secure.example.com domain which won't mess up your main site. If you've been thinking about hosting a site on Tor, then this might be a good option, too.

The best resources that I've found for explaining these steps are https://https.cio.gov , https://certificate-transparency.org , and https://twitter.com/konklone

@alok-mishra
alok-mishra / trakt-remove-all-from-collection.js
Last active May 6, 2024 04:51
Remove all items from Trakt collection
// Removes all items from a page of the Trakt collection
// Run script from console of user's collection page
// Must be run on each page
$(".posters .grid-item").each(function() {
actionWatch($(this).closest('.grid-item'), 'collect', true)
})
@alces
alces / ansible_local_playbooks.md
Last active April 5, 2024 18:28
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@fnkr
fnkr / ascii_table.py
Created May 12, 2016 09:08
ASCII Tables with Python 3
# Python 3
def pprinttable(rows):
if len(rows) > 1:
headers = rows[0]._fields
lens = []
for i in range(len(rows[0])):
lens.append(len(max([x[i] for x in rows] + [headers[i]],key=lambda x:len(str(x)))))
formats = []
hformats = []
for i in range(len(rows[0])):
@fnkr
fnkr / imagemagick-print-width-height.sh
Last active May 12, 2016 09:21
Print width and height with ImageMagick's identify tool.
identify -format '%wx%h' image.png
@fnkr
fnkr / kirby-subdir.nginxconf
Created May 12, 2016 09:05
Nginx configuration for Kirby A) in domain's root directory (e.g. example.com) B) in subdirectory named /kirbycms/ (e.g. example.com/kirbycms/).
# e.g. for example.com/kirbycms/
location /kirbycms/ {
if (!-e $request_filename) {
rewrite ^/kirbycms/(.*)$ /kirbycms/index.php last;
break;
}
}
@fnkr
fnkr / random-string.sh
Last active March 31, 2017 08:00
Generate random, alphanumeric strings in Bash.
#!/bin/bash
RANDSTR="$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c 40)"
@spiette
spiette / jinja_variables_types.yml
Created March 3, 2016 14:52
Test the variables types in jinja2 templates, used here with ansible
---
- hosts: all
gather_facts: no
vars:
string: "string"
list:
- item1
- item2
dict:
key1: value1
@edtjones
edtjones / zabbix_cleanup.sql
Created February 10, 2016 13:55
Clean up zabbix database
SET @history_interval = 7;
SET @trends_interval = 90;
DELETE FROM alerts WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM acknowledges WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM events WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM history WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM history_uint WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM history_str WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);