Skip to content

Instantly share code, notes, and snippets.

@will-hart
will-hart / build.py
Last active January 26, 2023 12:35
Super Simple Static Site Generator (Python)
"""
Free to use under the MIT license
Builds a static site from a list of Markdown source files. The source
files should have the same directory structure as the desired output.
Files are rendered using Markdown2 and can declare metadata variables:
---
@orjanv
orjanv / gist:f05033316e96cde2b510
Last active September 12, 2019 02:12
Convert swf to gif
swfrender -o out.png fig_1853.swf
mogrify -resample 72x72 -resize 256x256 *.png
convert -delay 100 -loop 1 out-*.png animation.gif
convert -delay 10 -loop 1 -background white -alpha remove -layers OptimizePlus out-*.png animation.gif
convert \
-delay 10 \
$(for i in $(seq 0 5 100); do echo foo${i}.png; done) \
-loop 0 \
@rememberlenny
rememberlenny / vanilla.js
Last active April 21, 2021 21:30
How to post to Google docs using a jQuery ajax POST request
// url is the link for the form view page
// data is the name attribute of the field
$.ajax({
url: "https://docs.google.com/forms/d/1iqMixtVq4O0AFvYCZHbGerigi1G5Qb3XthXZX9VpNtk/formResponse",
data: { "entry.1679407376": field1},
type: "POST",
dataType: "xml",
statusCode: {
1. No way of reusing task output in main play.
2. Cannot specify multiple fail_when statements.
3. [*] A play is atomic, i.e. I can't take the output from a command, parse its json then act on it. I need to create an intermediary fact containing the json dict then use that in another play. It's tedious.
4. If you're missing a variable in a variable file, Ansible won't fail to parse it. It will just tell you "VARIABLE IS NOT DEFINED!," which is ambiguous
5. Doing anything "complicated" (like looping within a loop for deeply nested Ansible variables) is right out.
6. selectattr doesn't actually do what you think it does!
7. Missing vars within tasks or roles can lead to very very VERY cryptic errors
8. So you can't set booleans with set_facts without casting......... https://github.com/ansible/ansible/issues/5463
9. It would be great if I could say something like:
@RainmanNoodles
RainmanNoodles / hs-fuzzy-window-picker.lua
Last active June 8, 2023 15:49
Hammerspoon Fuzzy Window Switcher
-- Fuzzy Window Switcher
_fuzzyChoices = nil
_fuzzyChooser = nil
_fuzzyLastWindow = nil
function fuzzyQuery(s, m)
s_index = 1
m_index = 1
match_start = nil
@halr9000
halr9000 / README.md
Last active February 27, 2022 05:00
How to make fake data in Splunk using SPL

How to make fake data in Splunk using SPL

Sometimes, you need to fake something in Splunk. Might be during development and you don't feel like writing a real search, but you really need a number for a dashboard panel to look right. Maybe you are helping someone with a hairy regex, and you don't want to index data just to test it on your instance. Whatever the reason, here are some searches that have helped me out.

Note that when using these techniques, you are not going through the indexing

<Sysmon schemaversion="4.32">
<!-- Capture all hashes -->
<HashAlgorithms>*</HashAlgorithms>
<DnsLookup>False</DnsLookup>
<ArchiveDirectory>Archive</ArchiveDirectory>
<EventFiltering>
<RuleGroup name="" groupRelation="or">
<!-- Event ID 1 == Process Creation. Log all newly created processes except -->
<ProcessCreate onmatch="exclude">
<Image condition="contains">splunk</Image>
@ueokande
ueokande / benchmark-commands.md
Last active January 22, 2024 12:38 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@rcmorano
rcmorano / docker-registry-expect-scripted-login
Created March 29, 2017 09:52
expect script to interact with "docker login"
#!/bin/bash
#DOCKER_REGISTRY_URI=_DOCKER_REGISTRY_URI_
#DOCKER_REGISTRY_USER=_DOCKER_REGISTRY_USER_
#DOCKER_REGISTRY_PASS=_DOCKER_REGISTRY_PASS_
expect <<EOF
spawn docker login -u $DOCKER_REGISTRY_USER $DOCKER_REGISTRY_URI
while (1) {
expect {
@tomasbasham
tomasbasham / install_tmux_osx_no_brew
Last active April 29, 2024 08:46 — forked from Fi5t/install_tmux_osx_no_brew
Install tmux on OSX WITHOUT brew
# Create a directory
mkdir ~/tmux-install
cd ~/tmux-install
# Get the files
curl -OL https://www.openssl.org/source/openssl-1.0.2l.tar.gz
curl -OL https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
curl -OL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
# Extract them