Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
Squashing bugs but sparing the cute ones!

Noah Doersing doersino

🐛
Squashing bugs but sparing the cute ones!
View GitHub Profile
@doersino
doersino / read_update.php
Last active Aug 29, 2015
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
View read_update.php
<!-- 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);
@doersino
doersino / webcam_dl.sh
Last active Aug 29, 2015
Downloads a webcam image, overlays the date/time, and compress past images into ZIP and MP4 format.
View webcam_dl.sh
#!/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 / backup_gists.py
Last active Aug 29, 2015 — forked from statX/downloadGists.py
Clone or update a user's public gists. Usage: backup_gists.py USERNAME [DIR]
View backup_gists.py
#!/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 / backup_sync.sh
Last active Aug 29, 2015
Rsync wrapper with sanity checking for some of the most common use cases.
View backup_sync.sh
#!/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 / setvolume.sh
Created Sep 19, 2015
Sets the volume on a Mac.
View setvolume.sh
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 / imagesnap_avoidmemoryleak.sh
Last active Sep 30, 2015
Avoids the memory leak occuring when capturing many webcam pictures using imagesnap version 0.2.5 by regularly restarting the command.
View imagesnap_avoidmemoryleak.sh
#!/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 / backup_uberspace.sh
Created Oct 8, 2015
Creates a backup of your Uberspace home folder, as well as your websites and MySQL databases.
View backup_uberspace.sh
#!/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 / settitle.sh
Created Jan 26, 2013
Sets the window/tab title on an OS X terminal.
View settitle.sh
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 / dotp.s
Last active Jul 6, 2016 — forked from tvh/dotp.s
This fork works with llvm-general-3.4.6.0.
View dotp.s
; 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 / read-get-titles.php
Last active Sep 8, 2016
Will attempt to (re-)get titles and sources for all articles in ReAD where the title is empty.
View read-get-titles.php
<?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` = ''");
You can’t perform that action at this time.