Skip to content

Instantly share code, notes, and snippets.

Sauna
3 Reviews
5
/
5
by AustinH
@tazle
tazle / Dockerfile
Created April 16, 2019 19:23
Dockerfile for running mapgen scripts
FROM debian:9
RUN apt-get update && apt-get install -y gdal-bin
RUN apt-get install -y python
RUN apt-get install -y p7zip mapserver-bin wget
COPY mapgen /mapgen
RUN mkdir -p /script
COPY gen-kebne.py /script/gen-kebne.py
$ netplan ip leases eth0
Traceback (most recent call last):
File "/usr/sbin/netplan", line 23, in <module>
netplan.main()
File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/ip.py", line 57, in run
self.run_command()
@tazle
tazle / getButton.py
Created December 17, 2017 22:49 — forked from jburgess777/getButton.py
Script to find a Bluetooth camera remote and print the button events
#!/usr/bin/env python
import sys
import evdev
devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()]
if len(devices) == 0:
print "No devices found, try running with sudo"
sys.exit(1)
Why does test.sh (see below) fail with:
$ sh test.sh
+ export 'TESTVAR=FOO BAR BAZ'
+ TESTVAR='FOO BAR BAZ'
++ for E in TESTVAR
+++ eval echo '$TESTVAR'
++++ echo FOO BAR BAZ
++ echo 'TESTVAR='\''FOO BAR BAZ'\'''
+ 'TESTVAR='\''FOO' BAR 'BAZ'\''' echo foo
tazle@tin:~$ command /sbin/ipset list ADDRv4_switch0 | grep -A1 Members
Members:
10.0.1.1
tazle@tin:~$ command /sbin/ipset list NETv4_switch0 | grep -A1 Members
Members:
0.0.1.0/24
import itertools
import re
def loseargs(f):
def g(*args, **kwargs):
return f()
return g
def serial_replace(template):
for r in itertools.count(1):
import sys
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams
def treematch(node, match, nomatch, extract):
if match(node):
yield extract(node)
elif nomatch(node):
return
else:
for subnode in node:
for result in treematch(subnode, match, nomatch, extract):
yield result
import sys
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams