Skip to content

Instantly share code, notes, and snippets.

View SpotlightKid's full-sized avatar

Christopher Arndt SpotlightKid

View GitHub Profile
@SpotlightKid
SpotlightKid / aescrypt.py
Created September 3, 2014 18:29
Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
Usage:
File Encryption:
aescrypt.py [-f] infile [outfile]

The reStructuredText Cheat Sheet: Syntax Reminders

Info

See <http://docutils.sf.net/rst.html> for introductory docs.

Author

David Goodger <goodger@python.org>

Date

$Date: 2013-02-20 01:10:53 +0000 (Wed, 20 Feb 2013) $

Revision

$Revision: 7612 $

Description

This is a "docinfo block", or bibliographic field list

Note

If you are reading this as HTML, please read

@mottosso
mottosso / README.md
Last active August 11, 2022 14:24
Filtering in QML ListView
@protrolium
protrolium / ffmpeg.md
Last active May 3, 2024 18:58
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@ju2wheels
ju2wheels / Dockerfile
Last active March 9, 2024 13:37
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'threading_design.ui'
#
# Created: Thu Aug 6 13:47:18 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
@brantsch
brantsch / i3lock-wrapper.sh
Created October 4, 2015 08:16
Wrap i3lock to randomly select an image from a folder and automatically scale it to fit your monitor resolution.
#!/bin/bash
random_wallpaper="$(find $1 -maxdepth 1 -name *.png | shuf | head -1)"
actual_size="$(identify -format %wx%h $random_wallpaper)"
target_size=$(xrandr | head -n 1 | awk -e '{OFS=""; gsub("[ ,]+","",$10); print $8,"x",$10;}')
if [[ "$actual_size" != "$target_size" ]]; then
convert "$random_wallpaper" -background black -gravity center -scale $target_size -extent $target_size png:- | i3lock -i /proc/self/fd/0
else
i3lock -t -i "$random_wallpaper"
fi
@mdsaleemj
mdsaleemj / install_execstack_on_ubuntu.md
Created October 19, 2015 07:07
How to install execstack on Ubuntu and Arch Linux

Execstack is a great tool for learning and training on Linux. It is a program which sets, clears, or queries the executable stack flag of ELF binaries and shared libraries. When I was looking to install it I took me a bit to find which package to install it in.

You can install with :

Ubuntu

$ sudo apt-get install prelink

Arch Linux

@SpotlightKid
SpotlightKid / namedtuple_defaultargs.py
Last active October 10, 2018 18:36
Python namedtuple with default attribute values
from collections import namedtuple, OrderedDict
from functools import partial
# important: pass (name, value) pairs as a tuple/sequence not as keyword args!
# otherwise, order will not be preserved.
fields = OrderedDict((('foo', "bar"), ('spamm', "eggs"), ('ham', None)))
T = partial(namedtuple("T", fields), **fields)
t1 = T()
print(t1)
t2 = T(ham="bacon")
@ventosus
ventosus / Makefile
Last active January 4, 2019 23:58
LV2 discovery by plugin class
all: list
lv2_class: lv2_class.c
gcc -std=gnu99 -O3 -o $@ $< $(shell pkg-config --cflags --libs lilv-0)
list: lv2_class
./$< \
| sort \
| sed 's/,/\n/g' \
| zenity \