Skip to content

Instantly share code, notes, and snippets.

Darren Worrall DazWorrall

Block or report user

Report or block DazWorrall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DazWorrall
DazWorrall / zoom_toggle.py
Last active Jun 26, 2019
Figuring out kitty stack layout with borders
View zoom_toggle.py
def main(args):
pass
def enable_borders(tab):
tm = tab.tab_manager_ref()
if tm is None:
return
w = tab.active_window
tab.borders(
[w], w, tab.current_layout, tm.blank_rects, True
@DazWorrall
DazWorrall / foo.rb
Created Mar 1, 2019
Redis sorted sets with timestamps for scores
View foo.rb
require 'redis'
require 'active_support/time'
redis = Redis.new
# members are added with a score that is a timestamp of when they should expire
redis.zadd('test-sset', 10.minutes.from_now.to_i, 'app1')
# let's add one in the past so we can test some more
redis.zadd('test-sset', 10.minutes.ago.to_i, 'app2')
@DazWorrall
DazWorrall / foo.rb
Last active Feb 28, 2019
This inheritance behaviour gets me every time
View foo.rb
class Foo
A = true
def m
A
end
def n
self.class::A
end
@DazWorrall
DazWorrall / headers.out
Created Jan 19, 2018
Response headers downloading a file from a GCS bucket via storage.cloud.google.com
View headers.out
HTTP/2.0 200 OK
x-guploader-uploadid: AEnB2UpX1g6M8f1SQ2P_fEitVF68n45d9lPxTdCGPjAQYsSE3QKlGJzTuOmSMg2u3LbkRdiE9vkKTFl5wGwq2alhyBFN2OuH5Q
content-type: binary/octet-stream
etag: CKy+lqng4dgCEAE=
vary: Origin, X-Origin
x-goog-generation: 1516286750596908
x-goog-hash: crc32c=UekceA==,md5=QfHUMNq1qX9LyLU1hdQD7Q==
x-goog-metageneration: 1
x-goog-storage-class: MULTI_REGIONAL
cache-control: no-cache, no-store, max-age=0, must-revalidate
@DazWorrall
DazWorrall / iptables_policy.py
Created Jul 22, 2016
Ansible module to set the default policy on an iptables chain, tested on Debian and derivatives
View iptables_policy.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import re
def get_policy(module, table, chain):
command = ['iptables', '-t{}'.format(table), '-L{}'.format(chain)]
rc, out, err = module.run_command(command)
if rc != 0:
raise RuntimeError("Unable to get policy: {}".format(err))
@DazWorrall
DazWorrall / config.json
Created Mar 22, 2016
Faking RHEV in qemu under packer so that cloud init takes its user data from a floppy disk
View config.json
{
"builders":
[
{
"type": "qemu",
"output_directory": "output",
"iso_url": "trusty-server-cloudimg-amd64-disk1.img",
"iso_checksum": "cf12c9878c9fb71c95d8f8c288761a99",
"iso_checksum_type": "md5",
"ssh_wait_timeout": "300s",
@DazWorrall
DazWorrall / interfaces
Created Feb 11, 2016
Interfaces file with vlans and vxlans
View interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
@DazWorrall
DazWorrall / carbon-cache-1.log
Created Jan 29, 2016
1 carbon-relay in front of 4 x carbon-cache
View carbon-cache-1.log
29/01/2016 11:28:48 :: [query] 127.0.0.1:48390 connected
29/01/2016 11:28:48 :: [query] [127.0.0.1:48390] cache query bulk for "6" metrics returned 477 values
29/01/2016 11:28:48 :: [query] [127.0.0.1:37758] cache query bulk for "32" metrics returned 2025 values
29/01/2016 11:28:53 :: [query] [127.0.0.1:37758] cache query bulk for "33" metrics returned 1897 values
@DazWorrall
DazWorrall / logstash.conf
Last active Nov 3, 2015
Grok config for Magento exception.log
View logstash.conf
input {
file {
path => "/path/to/exception.log"
type => "magento_exception"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
}
View test.yml
- hosts: localhost
gather_facts: false
connection: local
vars:
network_name: My Network
tasks:
- name: Create network
local_action:
module: cs_network
name: "{{ network_name }}"
You can’t perform that action at this time.