Skip to content

Instantly share code, notes, and snippets.

Noah Doersing doersino

Block or report user

Report or block doersino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View inttostr.c
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
char *inttostr_conventional(int n) {
char *s = (char*) malloc(sizeof(char) * 42);
sprintf(s, "%d", n);
return s;
}
@doersino
doersino / read_computeerts.php
Last active Sep 21, 2016
Upgrade script from ReAD commit f5bd3f4 to ad87e7b. See https://github.com/doersino/ReAD.
View read_computeerts.php
<?php
error_reporting(E_ALL);
require_once "deps/meekrodb.2.3.class.php";
require_once "TextExtractor.class.php";
$allArticles = DB::query("SELECT * FROM `read` ORDER BY `time_added` ASC");
$N = count($allArticles);
View sx2.m
% 1. download files from http://alumni.soe.ucsc.edu/%7Exzhu/doc/turbulence.html to current folder
%
% 2. run
% $ youtube-dl -o sx.mp4 https://www.youtube.com/watch?v=_BgJEXQkjNQ
% to download the video and
% $ ffmpeg -ss 00:00:50 -i sx.mp4 -filter:v fps=fps=60/1 frames/ffmpeg_%3d.png
% to extract the frames - quit this once it reaches frame 1310 or so
%
% 3. then run this script (might take a few days)
%
View sx.m
% 1. download files from http://alumni.soe.ucsc.edu/%7Exzhu/doc/turbulence.html to current folder
% and http://tmp.hejnoah.com/frames_Sothh.zip to subfolder "frames_Sothh"
%
% 2. run
% $ youtube-dl -o sx.mp4 https://www.youtube.com/watch?v=_BgJEXQkjNQ
% to download the video and
% $ ffmpeg -ss 00:01:05 -i sx.mp4 -filter:v fps=fps=60/1 frames/ffmpeg_%3d.png
% to extract the frames - quit this once it reaches frame 450 or so
%
% 3. then run this script
@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` = ''");
@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 / 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 / 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 / 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 / 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.)
#
You can’t perform that action at this time.