Skip to content

Instantly share code, notes, and snippets.

@comzeradd
comzeradd / boto-multipart-etag.py
Created September 27, 2013 16:24
[boto] force multipart ETag to match MD5 hash by copying it to a new file
from boto.s3.connection import S3Connection
# initiate the connection
conn = S3Connection(ACCESSKEY, SECRETKEY)
b = conn.get_bucket(BUCKET)
# Create a new multipart object out of 2 parts
mp = b.initiate_multipart_upload('joinedfile')
mp.copy_part_from_key(b.name, 'part1', 1)
mp.copy_part_from_key(b.name, 'part2', 2)
@comzeradd
comzeradd / post-checkout.sh
Created October 24, 2013 07:53
delete .pyc and empty folders on checkout
#!/usr/bin/env bash
# Delete .pyc files and empty directories from root of project
cd ./$(git rev-parse --show-cdup)
NUM_PYC_FILES=$( find . -name "*.pyc" | wc -l | tr -d ' ' )
if [ $NUM_PYC_FILES -gt 0 ]; then
find . -name "*.pyc" -delete
printf "\e[00;31mDeleted $NUM_PYC_FILES .pyc files\e[00m\n"
fi
@comzeradd
comzeradd / playlist.py
Created June 7, 2015 18:44
Random playlist with crossfaded tracks
import random
from glob import glob
from pydub import AudioSegment
playlist_songs = [AudioSegment.from_mp3(mp3_file) for mp3_file in glob("*.mp3")]
random.shuffle(playlist_songs)
playlist = playlist_songs.pop(0)
for song in playlist_songs:
playlist = playlist.append(song, crossfade=(15 * 1000))
@comzeradd
comzeradd / pad-push.py
Last active October 6, 2015 11:59
etherpad-lite push
#!/usr/bin/env python
# Using https://github.com/comzeradd/python-etherpad_lite
from etherpad_lite import EtherpadLiteClient, EtherpadException
import os
# Etherpad-lite API key and url
apikey = ''
base_url = ''
# Directory of old pad txt dumps
@comzeradd
comzeradd / qb50_decoder.py
Last active June 3, 2016 19:26
Decoding qb50 hex payload
#!/usr/bin/env python3
import json
import sys
import socket
from datetime import datetime, timedelta
EPOCH_DATE = datetime.strptime('20000101T000000Z', '%Y%m%dT%H%M%SZ')
UDP_IP = '127.0.0.1'
UDP_PORT = 16886
@comzeradd
comzeradd / angular-filter.html
Created October 29, 2016 18:59
render a json and filter out
<!DOCTYPE html>
<html lang="en" ng-app="mail">
<head>
<title>Mail Data</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div ng-view ng-controller="mailsCtrl">
@comzeradd
comzeradd / fedora-arm-headless.txt
Created May 9, 2017 18:40
fedora-arm headless
USER= # your user account
rm /run/media/$USER/__/etc/systemd/system/graphical.target.wants/initial-setup-graphical.service
rm /run/media/$USER/__/etc/systemd/system/multi-user.target.wants/initial-setup-text.service
mkdir /run/media/$USER/__/root/.ssh/
cat /home/$USER/.ssh/id_rsa.pub >> /run/media/$USER/__/root/.ssh/authorized_keys
chmod -R u=rwX,o=,g= /run/media/$USER/__/root/.ssh/

Keybase proof

I hereby claim:

  • I am comzeradd on github.
  • I am comzeradd (https://keybase.io/comzeradd) on keybase.
  • I have a public key whose fingerprint is 0A42 F419 4D19 DA71 11A1 BA09 3F35 3739 BCE4 F3DE

To claim this, I am signing this object:

@comzeradd
comzeradd / wp-dev.sh
Created February 14, 2022 09:15
Wordpress development environment
# Accessible in http://127.0.0.1:8889
# Username: admin
# Password: password
# On first run:
npm install
composer install
npm run build
npm run env:start
npm run env:install