Skip to content

Instantly share code, notes, and snippets.

View doersino's full-sized avatar
🐛
Squashing bugs but sparing the cute ones!

Noah Doersing doersino

🐛
Squashing bugs but sparing the cute ones!
View GitHub Profile
@doersino
doersino / read-get-titles.php
Last active September 8, 2016 19:45
Will attempt to (re-)get titles and sources for all articles in ReAD where the title is empty.
<?php
// Put this in the same folder as your https://github.com/doersino/ReAD install.
// This will attempt to (re-)get titles and sources for all articles where the
// title is empty.
require_once "lib/meekrodb.2.3.class.php";
require_once "Helper.class.php";
$q = DB::query("SELECT * FROM `read` WHERE `title` = ''");
@doersino
doersino / dotp.s
Last active July 6, 2016 18:43 — forked from tvh/dotp.s
This fork works with llvm-general-3.4.6.0.
; ModuleID = 'dotp.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readonly uwtable
define float @dotp(float* nocapture %a, float* nocapture %b, i32 %count) #0 {
%1 = icmp sgt i32 %count, 0
br i1 %1, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %0, %.lr.ph
@doersino
doersino / settitle.sh
Created January 26, 2013 21:42
Sets the window/tab title on an OS X terminal.
function settitle() {
local USAGE
USAGE="usage: settitle WINDOW_TITLE"
if [ -z "$1" ]; then
echo -e "$USAGE"; return 1
fi
echo -ne "\033]0;$1\007"
}
@doersino
doersino / backup_uberspace.sh
Created October 8, 2015 08:36
Creates a backup of your Uberspace home folder, as well as your websites and MySQL databases.
#!/bin/bash
# This script creates a backup of your Uberspace home folder, as well as your
# websites and MySQL databases. Configure username and server before running.
#
# TODO ^C should quit this entire script and clean up first (remove db backup)
# TODO some error handling and exit codes
# TODO set username and server via flags
# TODO sanity checking before backup: "these server contents get copied to this local folder"
@doersino
doersino / imagesnap_avoidmemoryleak.sh
Last active September 30, 2015 16:53
Avoids the memory leak occuring when capturing many webcam pictures using imagesnap version 0.2.5 by regularly restarting the command.
#!/bin/bash
# Avoids the memory leak occuring when capturing many webcam pictures using
# imagesnap version 0.2.5 by regularly restarting the command.
#
# As a result, the interval between successive pictures is not always exactly as
# specified in $IMAGESNAP_CONFIG. To get as close to it as possible, set
# $RESTART_INTERVAL to some multiple of the -t interval.
# By default, imagesnap is configured to wait 1s before taking the first
# picture: without this delay, the first picture tends to be underexposed.
@doersino
doersino / setvolume.sh
Created September 19, 2015 09:38
Sets the volume on a Mac.
function setvolume() {
local USAGE
USAGE="usage: setvolume NUMBER_FROM_0_AND_7"
if [ -z "$1" ]; then
echo -e "$USAGE"; return 1
fi
osascript -e "set volume $1"
}
@doersino
doersino / backup_sync.sh
Last active August 29, 2015 14:14
Rsync wrapper with sanity checking for some of the most common use cases.
#!/bin/bash
# Performs an rsync with predefined flags, configurable default arguments, only
# the most important options (dry-run and excludes), and sanity checking.
#
# Usage:
# ./backup_sync.sh [-n] [-e EXCLUDE] [-f FLAGS] [-d] [SRC] [DEST]
#
# (If SRC or DEST are not given, the defaults will be used.)
#
@doersino
doersino / backup_gists.py
Last active August 29, 2015 14:12 — forked from asw456/downloadGists.py
Clone or update a user's public gists. Usage: backup_gists.py USERNAME [DIR]
#!/usr/bin/env python
# Clone or update a user's public gists.
# Usage: backup_gists.py USERNAME [DIR]
import json
from subprocess import call
from urllib import urlopen
import os
import sys
@doersino
doersino / webcam_dl.sh
Last active August 29, 2015 14:11
Downloads a webcam image, overlays the date/time, and compress past images into ZIP and MP4 format.
#!/bin/bash
# http://www.reddit.com/r/spacex/comments/2pwjni/live_video_of_asds_in_port/cn19n2i?context=7
# https://gist.github.com/doersino/ade1edd8fe154ea30ba4
#
# This script downloads a webcam image to a date/hour-labeled directory,
# creating intermediate directories as required, making sure that the image is
# not corrupt, and optionally overlaying the current date and time on the image
# and maintaining a mirror of the webcam. Any images from the previous day will
# optionally be ZIP-compressed and compiled into a MP4 video after the first
@doersino
doersino / read_update.php
Last active August 29, 2015 14:06
Quick-and-dirty script for getting the source of articles added to a local install of ReAD before this commit: https://github.com/doersino/ReAD/commit/80f08d303f0b2cad7c9263b82ad59794c46208a9
<!-- gets source of your previously ReAD articles
before executing this file, update your database according to the
import.sql file (i.e. add a column "source" of type MEDIUMTEXT to the
"read" table) -->
<meta charset="UTF-8"><body style="overflow-x: scroll;"><pre><?php
error_reporting(E_ALL);
ini_set('max_execution_time', 30);