Skip to content

Instantly share code, notes, and snippets.

@yellowcrescent
yellowcrescent / gifmake.py
Created June 22, 2017 17:46
gifmake example
#!/usr/bin/python
# coding=utf-8
import os
import sys
import re
import json
import subprocess
from moviepy.editor import VideoFileClip
from moviepy.video.tools.cuts import FramesMatches
@yellowcrescent
yellowcrescent / lsattr.py
Last active March 8, 2020 22:15
get filesystem attribs (like immutable) with python
import fcntl
from array import array
# FS constants - see /uapi/linux/fs.h in kernel source
# or <elixir.free-electrons.com/linux/latest/source/include/uapi/linux/fs.h>
FS_IOC_GETFLAGS = 0x80086601
FS_IMMUTABLE_FL = 0x010
with open(FILENAME) as f:
@yellowcrescent
yellowcrescent / idrac_fix.c
Created April 13, 2017 17:17
iDRAC7 segfault workaround
/********************************************************************
*
* iDRAC7 segfault workaround
* jacob@ycnrg.org
*
* Stolen from: <https://kempniu.wordpress.com/2015/04/29/idrac-virtual-console-linux-and-segfaults/>
*
* To compile: gcc -fPIC -ldl -o idrac_fix.so idrac_fix.c
* To use: LD_PRELOAD=./idrac_fix.so javaws viewer.jnlp
*
@yellowcrescent
yellowcrescent / yc_pdnsadmin.patch
Created March 28, 2017 03:13
add SOA serial auto-update & trigger NOTIFYs to powerdns admin
diff --git a/app/models.py b/app/models.py
index 9aee967..9a116b8 100644
--- a/app/models.py
+++ b/app/models.py
@@ -10,6 +10,7 @@ import pyotp
import re
import dns.reversename
+import arrow
from datetime import datetime
@yellowcrescent
yellowcrescent / freeipa32.patch
Created February 26, 2017 07:47
freeipa patch for /32 addresses
--- /usr/lib/python2.7/site-packages/ipapython/ipautil.py 2017-02-26 02:44:32.526550796 -0500
+++ /usr/lib/python2.7/site-packages/ipapython/ipautil.py 2017-02-26 02:44:56.597050635 -0500
@@ -132,8 +132,8 @@
Reserved or link-local addresses are never accepted.
"""
def __init__(self, addr, match_local=False, parse_netmask=True,
- allow_network=False, allow_loopback=False,
- allow_broadcast=False, allow_multicast=False):
+ allow_network=True, allow_loopback=False,
+ allow_broadcast=True, allow_multicast=False):
### Keybase proof
I hereby claim:
* I am yellowcrescent on github.
* I am crescent (https://keybase.io/crescent) on keybase.
* I have a public key whose fingerprint is A96E 858A 4844 CDD2 17C5 BA6C CAAB 13B5 9DA9 9403
To claim this, I am signing this object:
@yellowcrescent
yellowcrescent / win10_vfio.xml
Created February 13, 2017 05:02
win10 vfio libvirt configuration
<domain type='kvm' id='3'>
<name>win10</name>
<uuid>82049288-9126-4c14-9cb8-bb45f0525fb4</uuid>
<memory unit='KiB'>12582912</memory>
<currentMemory unit='KiB'>12582912</currentMemory>
<vcpu placement='static'>8</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='0'/>
<vcpupin vcpu='1' cpuset='1'/>
<vcpupin vcpu='2' cpuset='2'/>
@yellowcrescent
yellowcrescent / avr_ohayo.c
Last active December 21, 2016 04:32
avr blinky test
#include <avr/io.h>
#include <avr/cpufunc.h>
#define LED_PIN (1<<PD4)
void main() {
DDR |= LED_PIN;
PORTD |= LED_PIN;
@yellowcrescent
yellowcrescent / fail2ban.yml
Created December 15, 2016 04:56
fail2ban ansible playbook for ce7, ubuntu, and debian
# vim: set ts=2 sw=2 expandtab syntax=yaml:
---
- hosts: all
tasks:
- name: Configure vars (Debian)
set_fact:
paths_include: paths-debian.conf
when: ansible_os_family == "Debian" or ansible_os_family == "Ubuntu"
- name: Configure vars (EL)
@yellowcrescent
yellowcrescent / deadburn
Created December 15, 2016 01:41
deadburn
#!/usr/bin/php
<?php
/*
deadBurn
Multi-tool for working with DeadBeef playlists
including burning CDs.
Copyright (c) 2011-2012 Jacob Hipps