Skip to content

Instantly share code, notes, and snippets.

%TAG ! tag:nuxi.nl,2015:cloudabi/
---
stderr: !fd stderr
path: !file
path: _obj/install/x86_64-unknown-cloudabi/python/lib/python3.6
nousersite: true
nosite: true
command: >-
import sys;
@moreati
moreati / example.md
Last active May 19, 2018 06:20
Read and Execute permissions on Linux directories, by example

Preperation

Create 3 top-level directories. Create a file and a directory in each.

$ mkdir r rx x
$ touch {r,rx,x}/file
$ mkdir {r,rx,x}/dir
@moreati
moreati / test.html
Last active July 3, 2017 00:35
Trying a custom named entity with (X)HTML
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
<title>Testy test</title>
</head>
<body style="background: black;">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
@moreati
moreati / fstring_checker.py
Last active December 19, 2017 23:13
Pylint plugin that checks for non f-string literals, with format() style string interpolation
import re
import tokenize
import astroid
from pylint.checkers import BaseChecker, BaseTokenChecker
from pylint.interfaces import IAstroidChecker, ITokenChecker
FORMAT_PATT = re.compile(r'\$\{.*?}')
from cStringIO import StringIO
import sys
import ruamel.ordereddict
import ruamel.yaml
s = '''\
foo:
bar: baz
@moreati
moreati / requirements.txt
Last active June 24, 2022 22:23
Attempts to find a faster way of checking for characters in a string
python-pcre
re2
regex
rure
@moreati
moreati / _float_swap.pyx
Created June 18, 2019 21:18
Cython byte swap demo
from libc.string cimport memcpy
cpdef bytes noswap():
cdef double pi = 3.14159
cdef unsigned char buf[8]
memcpy(&buf, &pi, 8)
return buf[:8]
cpdef bytes swap():
cdef double pi = 3.14159
@moreati
moreati / human-readable-hash-comparisons.md
Created January 17, 2020 22:44 — forked from raineorshine/human-readable-hash-comparisons.md
An aesthetic comparison of a few human-readable hashing functions.

An Aesthetic Comparison of Human-Readable
Hashing Functions

The following compares the output of several creative hash functions designed for human readability.

sha1's are merely used as arbitrary, longer, distributed input values.

input 1 word output 2 word output 3 word output
@moreati
moreati / .ssh_config
Last active April 16, 2023 01:40
Playing Guess Who with Ansible
Host rpi1
HostName raspberrypi1.local
User pi
Host rpi2
HostName raspberrypi2.local
User pi
@moreati
moreati / playbook.yml
Last active October 21, 2020 15:16
Ansible var vs fact oddity
- hosts: localhost
gather_facts: false
vars:
regex: ^(\w{3}\s+\d+\s\d+:\d+:\d+)\s?:\s?(\w+)\s+:.*(?:\r?\n(?!.*COMMAND).*)*\r?\n.*?COMMAND=(.*(?:\r?\n(?!\w{3}\s+\d+\s\d+).*)*)
tasks:
- name: slurp file
slurp:
src: sudo.log
register: slurped