Skip to content

Instantly share code, notes, and snippets.

lsowen

Block or report user

Report or block lsowen

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
@lsowen
lsowen / notes.md
Last active Apr 29, 2017
emacs/tmux integration
View notes.md
@lsowen
lsowen / Extend_KVM_guest.txt
Created Jun 28, 2016
Quick notes on size a KVM guest (which uses LVM) up
View Extend_KVM_guest.txt
On supervisor:
lvextend -L50G /dev/vg_kvmhost01/test-01.img
virsh qemu-monitor-command util-02 --hmp "info block"
virsh qemu-monitor-command util-02 --hmp "block_resize drive-virtio-disk0 50G"
On VM:
http://unix.stackexchange.com/a/42910
@lsowen
lsowen / check_sig.go
Last active May 8, 2019
GPG Signature Verification in go (with golang.org/x/crypto/openpgp)
View check_sig.go
package main
import (
"fmt"
"golang.org/x/crypto/openpgp"
"os"
)
func main() {
keyRingReader, err := os.Open("signer-pubkey.asc.txt")
@lsowen
lsowen / README.md
Created Oct 5, 2015
django-rest-framework-json-api dynamic filter relationship
View README.md

I needed to be able to filter which items of a ManyRelatedField were returned, based on some attributes of the request user. Normally, all items in the relationship are returned, however I was able to override the ManyRelatedField.to_attribute() function to enable additional filtering of the relationship.

@lsowen
lsowen / onvif_request.py
Last active Mar 8, 2019
Create valid ONVIF request to Dahua IPC-HDW2100
View onvif_request.py
#!/usr/bin/env python3
import hashlib
import os
import base64
from datetime import datetime
username = "admin"
@lsowen
lsowen / update-dns.sh
Last active Jul 6, 2019
Calculate Reverse ipv6 PTR Record in Bash (using awk and sed)
View update-dns.sh
function reverseIp6 {
echo "$1" | awk -F: 'BEGIN {OFS=""; }{addCount = 9 - NF; for(i=1; i<=NF;i++){if(length($i) == 0){ for(j=1;j<=addCount;j++){$i = ($i "0000");} } else { $i = substr(("0000" $i), length($i)+5-4);}}; print}' | rev | sed -e "s/./&./g"
}
$(reverseIp6 "2001:db8:85a3::8a2e:370:7334")"ip6.arpa."
#Result: 4.3.3.7.0.7.3.0.e.2.a.8.0.0.0.0.0.0.0.0.3.a.5.8.8.b.d.0.1.0.0.2.ip6.arpa.
@lsowen
lsowen / main.go
Last active Nov 11, 2017
Example to create Rackspace Files TempURL with golang
View main.go
package main
// Based on documentation found here: http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"fmt"
"github.com/ncw/swift"
View keybase.md

Keybase proof

I hereby claim:

  • I am lsowen on github.
  • I am lsowen (https://keybase.io/lsowen) on keybase.
  • I have a public key whose fingerprint is 337C E5E0 6C9E 3677 CCC7 1A40 FECD 001B C751 40C0

To claim this, I am signing this object:

View gist:4f51a27cc58cf56884b4
package main
import (
"fmt"
"os"
"github.com/armon/mdns"
"sync"
)
func channelHandler(wg sync.WaitGroup, ch <-chan mdns.ServiceEntry) {
@lsowen
lsowen / tlsimap.py
Last active Jun 14, 2016 — forked from kiowa/tlsimap.py
Update to work with Python 2.7.3
View tlsimap.py
""" Python IMAP with TLS/SSL support """
##
## Author: Alexander Brill <alex@brill.no>
## Copyright (C) 2004 Alexander Brill
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
You can’t perform that action at this time.