Skip to content

Instantly share code, notes, and snippets.

View jahewson's full-sized avatar
🏡
Remote

John Hewson jahewson

🏡
Remote
View GitHub Profile
#include <stdio.h>
#include <tensorflow/c/c_api.h>
int main() {
  printf("Hello from TensorFlow C library version %s\n", TF_Version());
  return 0;
}
@jahewson
jahewson / gdb.sh
Last active December 12, 2015 02:58
gdb quickstart
# first, compile your code with the `-g` flag
# this will get you line numbers
# now launch gdb with whatever arguments your program uses
gdb --args path/to/executable -every -arg you can=think < of
# to start debugging
run
# to get a stack trace
@jahewson
jahewson / stroked-text.html
Created January 31, 2013 23:10
stroked text
<!DOCTYPE html>
<!-- Created by pdf2htmlEX (http://github.com/coolwanglu/pdf2htmlEX) -->
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX"/>
<style type="text/css">
/* Base CSS */
/* Copyright 2012 Lu Wang <coolwanglu@gmail.com> */
#pdf-outline { /* PDF Outline */
@jahewson
jahewson / smartos-on-a-budget.sh
Last active March 9, 2024 07:27
Installing and Configuring SmartOS on a budget server (with a /29)
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##################################################################
Installing and Configuring SmartOS on a budget server (with a /29)
##################################################################
# if you find this gist useful, please star it
# please be aware that budget hosting companies usually cut corners somewhere,
@jahewson
jahewson / gist:1669691
Created January 24, 2012 11:18
RegEx escape
function escapeRegEx(str) {
return str.replace(/([\^\$\(\)\<\>\|\\\{\[\]\.\*\+\?])/g, '\\$1');
}
@jahewson
jahewson / gist:1476464
Created December 14, 2011 12:55
loop over files in Bash, splitting filename and extension
# filter for .c files
for f in *.c
do
#filename
echo $f
# filename without extension
echo ${f%.*}
# extension
@jahewson
jahewson / gist:1427939
Created December 3, 2011 19:45
SSH tunnel - remote 444 to local 5555
ssh -f user@example.com -L 5555:example.com:444 -N
@jahewson
jahewson / forward.sh
Created November 17, 2011 19:13
Linux kernel firewall: forward port 80 to port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080