whatsdoom.com

Digital Ocean API Wrapper

DateReadtime 3 minutes Tags

I found myself wanting to take snapshots of my digital ocean droplets. I wrote a quick python script that wraps the api and allows me to snapshot my droplet on a regular basis.

#! /usr/bin/env python

import requests
import time

API_KEY=''
CLI_ID=''

def fetch(path, opts={}):
    opts['api_key'] = API_KEY …
more ...

Getting a random file from a directory

DateReadtime 1 minutes Tags

I had a massive directory of files that I wanted to pick a few random files to test before I imported the whole set. For this post lets say I want 100 random files from some_dir and moving them to this_dir.

First you could use:

$ LIST=$(ls -1 ./some_dir | sort …
more ...

LVM resize

DateReadtime 1 minutes Tags
lvm / bash / sh

My root partition recently ran out of space and I needed to resize it.

So I booted into a live usb and then, after activating my volume groups:

$ sudo vgchange -a y

I looked up lvm resize online and came up with the command:

$ sudo lvextend -L+10G /dev/mapper …
more ...

Extension ram files

DateReadtime 1 minutes Tags

I was helping my girlfriend watch some videos that she needed for a class that she was having trouble playing on her mac. Once I saw that ubuntu wasn't able to play them out of the box I looked at the extension and found a solution on ubuntu forums.

The …

more ...

Broadcom Wireless Internet Setup

DateReadtime 1 minutes Tags

So I have had this issue where my wireless card would one day suddenly disappear. I had a wireless usb so I used that for a month or so and finally I decided that I would just reinstall and see if that fixed it. It did like magic but then …

more ...

Forward and Back Buttons

DateTags

For what ever reason perhaps just nostalgia possibly because I happen to use them more than expected, I have forward and back links on my website. The buttons are JavaScript powered and I have had "noscript" tags warning users of their lack of functionality since I added the links years …

more ...

Watermarking with Image Magick

DateSeries Part 4 of Image Magick Tags

I decided to try and start signing my pictures.

composite -watermark 15% -gravity southeast sign-1.png $i $i;

It needs more tweaking but that will do for now.

To convert all files in a directory:

for i in *.JPG; do
        echo -e "$i... \c";
        composite -watermark 15% -gravity southeast sign-1 …
more ...

pygments

DateTags

Pygments is a python based syntax highlighter.

Examples:

pygmentize -f html -l python -O full -o file.py.html  file.py

pygmentize -l latex -O full -o resume.tex.html resume.tex
more ...

Lost Partition Table

DateReadtime 4 minutes Tags

Step 1: Losing the Data

We will start this post off with a tip...

Never ever ever re-install a distribution when you are tired.

Long story short, I was re-installing Ubuntu at way to early in the morning and clicked "Erase Entire disk" about 2 seconds later I panicked and …

more ...