Skip to content

Instantly share code, notes, and snippets.

import evdev
import sys
from bluetooth import *
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)
@meeuw
meeuw / dropboxupload.py
Created December 7, 2017 14:42
upload script for dropbox
dbx = dropbox.Dropbox("secrethere")
destfile = '/path/to/file'
dbx.files_delete(destfile)
CHUNK_SIZE = 4 * 1024 * 1024
cursor = None
offset = 0
with open('/tmp/uploadthis') as f:
while 1:
buf = f.read(CHUNK_SIZE)
@meeuw
meeuw / pa_move_stream.sh
Created September 25, 2017 06:33
move pulseaudio sink-input to sink
pactl list short sink-inputs
pactl move-sink-input 0 0
@meeuw
meeuw / pyfed2epel.py
Created September 1, 2017 06:29
convert fedora python spec file to epel python spec file
#!/usr/bin/env python3
import sys
print('''%if 0%{?python3_pkgversion}
%global python3_pkgversion 34
%endif
''')
with open(sys.argv[1]) as f:
skip_until_startswith = None
for line in f:
if line == '%py2_install\n' or line == '%py2_build\n' or 'py.test-%{python2_version}' in line or '%{__python2}' in line:
@meeuw
meeuw / dump_properties.lua
Last active August 27, 2017 18:26
lua script to write all properties to /dev/shm/mpv-status every second
function writeproperty(name)
value = mp.get_property(name)
if value ~= nil then
file:write(string.gsub(value, "\n", "\\n"))
end
file:write("\n")
end
timer = mp.add_periodic_timer(1, function()
os.remove("/dev/shm/mpv-status")
file = io.open(string.format("/dev/shm/mpv-status", math.random(0, 100)), "w")
@meeuw
meeuw / phpdocker.py
Created August 3, 2017 14:50
script to start a command line php in a docker container
import requests_unixsocket
import os
import sys
import re
import subprocess
session = requests_unixsocket.Session()
r = session.get('http+unix://%2Fvar%2Frun%2Fdocker.sock/containers/json')
for c in r.json():
if c["Names"][0].startswith('/local.'):
@meeuw
meeuw / dnsall.py
Created June 3, 2017 11:41
script to query domain name on all available nameservers to check for zone transfer status
#!/home/meeuw/venv/dns/bin/python
import dns.resolver
import sys
import tld
if (len(sys.argv) > 2):
typ = sys.argv[2]
else:
typ = 'A'

Keybase proof

I hereby claim:

  • I am meeuw on github.
  • I am meeuw (https://keybase.io/meeuw) on keybase.
  • I have a public key ASBA3q6Zdq0N41JEBYmL6pdnTlAB67TE81jXXWMFbY9OdAo

To claim this, I am signing this object:

@meeuw
meeuw / .vimrc
Created April 3, 2017 08:54
vim proxy to execute remote extendscript files
nnoremap <leader>p <Esc>:w! /home/user/vimproxy/pipe<CR>
@meeuw
meeuw / backupcloudfiles.py
Created February 23, 2017 13:54
backup script for cloud files (openstack swift) for backups with retention
import subprocess
import tempfile
import select
import os
import sys
import copy
import datetime
src = sys.argv[1]
dst = sys.argv[1]+"-backup"