Skip to content

Instantly share code, notes, and snippets.

View alexanderankin's full-sized avatar

David Ankin alexanderankin

View GitHub Profile
@alexanderankin
alexanderankin / attempt1.c
Created October 24, 2016 23:51
leaky calculator
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum node_type
{
number, operation
} NType;
typedef enum op_type
@alexanderankin
alexanderankin / iteratordemo.c
Created November 20, 2016 23:55
Iterator for C
/**
* Learning Abstraction With C
*
* make with: cc iteratordemo.c -o iteratordemo -g
*
* works as ./iteratordemo, doesnt work as:
* $ valgrind --leak-check=full ./iteratordemo
*/
#include <stdio.h>
@alexanderankin
alexanderankin / index.diff
Created November 22, 2016 04:51
twitter changes draft
diff --git a/index.html b/index.html
index 6582498..12f71ac 100644
--- a/index.html
+++ b/index.html
@@ -98,6 +98,7 @@ comments: false
<div>
<!-- Tab panes -->
<div class="tab-content">
+ {% increment issue_number %}
{% for tab in site.data.data.tabs %}
typedef int boolean_t;
boolean_t (*status_checker_function)(void);
int change_bulb_required_engineers_recur(status_checker_function);
int change_bulb_required_engineers_recur(status_checker_function testbulb)
{
return _change_bulb_required_engineers_recur(testbulb, 0);
}
import random
NOUNS = [ "wings", "flowers", "Uggs", "bees", "tomatoes", "carrots", "teeth" ]
VERBS = [ "shoot", "fall", "walk", "jump", "butcher", "swim", "sleep", "dive" ]
ADJECTIVES = [ "ugly", "blue", "tart", "smelly", "yellow", "fleshy" ]
ADVERBS = [ "anxiously", "willfully", "angrily", "happily", "grossly", "hungrily"]
def makeSentence():
a = random.choice(ADJECTIVES)
n = random.choice(NOUNS)
/**
* Usage:
* wget this file into `./log_cleaner/script.js`, next to data.txt
* `cd ./log_cleaner`
* `node script.js`
*/
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var bufferSize = 300;
@alexanderankin
alexanderankin / curl_range.md
Last active March 9, 2017 19:01 — forked from mocchira/curl_range.md
HTTP GET with Range header by curl
# normal(explicitly specified start AND end)
curl -v -X GET -H "range: bytes=1-8" http://localhost:8080/bbb/test

# specified ONLY start(end will be specified at the end of file)
curl -v -X GET -H "range: bytes=10-" http://localhost:8080/bbb/test

# specified ONLY one negative value(last N bytes of file will be retrieved)
curl -v -X GET -H "range: bytes=-11" http://localhost:8080/bbb/test
@alexanderankin
alexanderankin / new-repository.sh
Created April 16, 2017 21:14
My Git Frontend
#!/bin/bash
alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
project_name=$1
bare_rep_dir="/home/`whoami`/bare-git/${project_name}" # bare repo directory
work_rep_dir="/home/`whoami`/my-apps/${project_name}" # working dir w/files
if [[ -d $bare_rep_dir && \
! -L $bare_rep_dir ]] ; then
echo "Already exists in $bare_rep_dir"
@alexanderankin
alexanderankin / bookmark.py
Last active October 13, 2018 14:10
fpdf2 Bookmarks Feature Draft Specification
from collections import OrderedDict as o_dict
from fpdf import FPDF
from fpdf.util import textstring
def create_dictionary_string(dict_):
"""format ordered dictionary as PDF dictionary"""
return ''.join([
'<<',
'\n'.join([' '.join(f) for f in dict_.items()]),
@alexanderankin
alexanderankin / README.md
Last active June 3, 2017 20:05
Feature Submission

Feature Request: NULL filtering

Motivation

To be able to configure an option to be able to filter rows without content inside of them. This is useful in tandem with the other search features present in this software when dealing with incomplete data.

Changes Summary

In the function which filters an individual column, I have implemented logic which runs a truth test on the cell value instead of checking against regex. With additional knowledge as to the inner workings of this library, this value could be configurable via an API, perhaps at initialization.