Farts and Craps With David Xia – Waterboarding

|

Waterboarding has been a controversial topic ever since the fall of 2007, when it was widely reported that the CIA was using waterboarding on extrajudicial prisoners and that the Justice Department authorized the procedure as an “enhanced interrogation technique.” Many consider waterboarding torture and a violation of Common Article 3 of the Geneva Conventions.

I’m in no way trying to diminish the implications waterboarding with this personal experiment. I wanted to experience waterboarding first-hand in order to better understand the context surrounding the debate. I never truly feared for my life because my trusted friends administered the waterboarding and I held a wooden block which I would drop when I couldn’t take anymore. But I can say that when done right, I felt like I was drowning. I had no control over my spasms and gags.


Ice Climbing at Lake Placid

|

I went ice climbing with some friends last weekend at Lake Placid, NY. Although it was physically punishing, it was a lot of fun. We learned a lot of rope and climbing skills and will definitely be applying them to our future spelunking or climbing trips.




Vim + Tmux + Cloud Virtual Machine = Increased Productivity

|

Recently I’ve been working with a kick-ass combination of Vim, tmux, and my cloud virtual machine that has increased my productivity.

Workflow

  1. Open terminal
  2. ssh into cloud VM
  3. Create a new tmux session (tmux new -s [session name]) or attach to an existing one (tmux attach -t [session name])
  4. List tmux sessions with tmux list-sessions
  5. Use Vim, open like 50 tabs, don’t care about it
  6. Lose network connection, put computer to sleep, abruptly or accidentally close terminal application because you’re like F**k this. I’m going home, or intentionally detach from tmux session (ctrl-b d)
  7. Reattach to tmux session
  8. BAM, it’s like you never left!

C Stdlib IO Functions and System Call Equivalents

|

I’m reading The C Programming Language and trying to remember C’s standard library functions for IO and their system call equivalents. I couldn’t find a side-by-side chart online, so I created this to help me.

C stdlib return value header system call return value header
files file pointer FILE *fp stdio.h file descriptor int td
streams stdin, stdout, stderr stdio.h 0, 1, 2
open FILE *fopen(char *name, char *mode) file pointer on success, NULL on failure stdio.h int open(char *name, int flags, int perms) file descriptor on success, -1 on error fctnl.h
create (fopen creates file if it doesn’t exist) int creat(char *name, int perms) fctnl.h
read int getc(FILE *fp); getchar = getc(stdin) next char, EOF on end of file or error stdio.h int read(int fd, char *buf, int n) number bytes read, 0 on EOF, -1 on error stdio.h
read char *fgets(char *line, int maxline); gets = fgets(stdin) *line on success, NULL on EOF or error stdio.h
write int putc(int c, FILE *fp) char written on success, EOF on error stdio.h int write(int fd, char *buf, int n) number bytes written, 0 on EOF, -1 on error stdio.h
write int fputs(char *line, FILE *fp); puts = fputs(stout) non-negative int on success, EOF on error stdio.h
close int fclose(FILE *fp) 0 on success stdio.h int close(int fd) 0 on success unistd.h
perms r, w, a
flags O_RDONLY, O_WRONLY, O_RDWR fctnl.h
BUFSIZ stdio.h



More Home Improvement, Pictures and an End Table

|

Our apartment’s couch is almost finished. The last step is to staple gun the faux suede for the back cushion into place. I built an end table to accompany the couch and constructed a pallet-looking shelf to serve as a pot rack.

But the best addition to our living space has been my roommate Gary’s framed posters. He was nice enough to share eight of his family’s four-by-three foot long pictures of movie stars, singers, and baseball players with us. Now these gorgeous hardwood frames to decorate our spartan walls. Marilyn Monroe, James Dean, Frank Sinatra, Dean Martin, Peter Lawford, Sammy Davis Jr., and Don and Michael Corleone now accompany us in our living room. Mickey Mantle, Joe DiMaggio, Babe Ruth, Muhammad Ali, and The Beatles reside in the hallway.


How to Build a Couch

|

The couch left behind by the previous tenants in my new apartment was in less than peak condition. It’s pleather cushions were peeling and shedding. Instead of buying a couch from Ikea for $600 to $800, my roommates and I decided to build one from pine 2x4s for a fraction of the cost.