Skip to content

Instantly share code, notes, and snippets.

View rhaps0dy's full-sized avatar
💭
solving AI alignment

Adrià Garriga-Alonso rhaps0dy

💭
solving AI alignment
View GitHub Profile
@rhaps0dy
rhaps0dy / Test.md
Last active August 29, 2015 14:03
Testing gist.io

#Hello

This is a Markdown file, and should be read as such! We can use bold and monospace and more things I can't remember, and we can

#include <stdio.h>

int
@rhaps0dy
rhaps0dy / howto.md
Last active August 29, 2015 14:03
HOWTO: Catch segmentation faults on gdb (GNU debugger)

Ever had those annoying SEGMENTATION FAULT errors? Ever screamed in frustration because you weren't able to find their cause? Don't worry, GDB to the rescue!

#A faulty program We have this C program: (prog1.c)

#include <stdio.h>

int
@rhaps0dy
rhaps0dy / anime.c
Created July 3, 2014 22:24
Comments for S3tanta's code
#include "../irc.h"
#include "../module.h"
#include "../config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static char *mod_invokers[1] = {NULL}; /* are you sure you don't want it to be called when "anime" is said? */
static void anime(char **args, enum irc_type type);
@rhaps0dy
rhaps0dy / nyazo.sh
Last active August 29, 2015 14:06
Nyazo in shell.
#!/bin/sh
BROWSER=firefox
XCLIP=xclip
BROWSER=`which $BROWSER`
XCLIP=`which $XCLIP`
TMP_IMG=/tmp/nyazo.png
TMP_FILE=/tmp/nyazo
BOUNDARY="----BOUNDARYBOUNDARY----"
@rhaps0dy
rhaps0dy / .xinitrc
Created October 12, 2014 16:17
WM setup
export LC_ALL='en_US.UTF-8'
export LANG='en_US.UTF-8'
xrdb ~/.Xdefaults
xmodmap ~/.xmodmap
synclient TapButton2=3 TapButton3=2 HorizTwoFingerScroll=1 \
VertTwoFingerScroll=1 VertScrollDelta=-104 HorizScrollDelta=-104 PalmDetect=1 \
PalmMinWidth=5 MaxTapTime=0 MaxTapMove=0
echo 300 > /sys/class/backlight/intel_backlight/brightness
while : ; do
cat /sys/class/power_supply/BAT0/charge_now
@rhaps0dy
rhaps0dy / xmonad.hs
Created February 18, 2015 22:27
xmonad configuration with XFCE
import XMonad
import XMonad.Config.Xfce
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.SetWMName
import qualified Data.Map as M
import qualified XMonad.StackSet as W
(setv test
(let [[a 5]
[b 7]]
(print a b)))
(print (type test))
@rhaps0dy
rhaps0dy / char-rnn-tf.py
Created November 21, 2015 18:37
NaNoGenMo character-based RNN, based on Karpathy's blog and code.
#!/usr/bin/env python2
import tensorflow as tf
import numpy as np
import time
# Hyperparameters
learning_rate = 1e-1
n_hidden = 100
seq_length = 25
n_show = 2500 // seq_length
@rhaps0dy
rhaps0dy / quine.c
Created December 17, 2015 00:23
Quine in C
#include<stdio.h>
void f(char*b){while(*b){if(*b=='"'||*b=='\\')putchar('\\');if(*b=='\n') printf("\\n"),b++; else putchar(*b++);}}
void g(char *c){printf("%s", c); putchar('"'); f(c); printf("\");}\n");}
int main(){g("#include<stdio.h>\nvoid f(char*b){while(*b){if(*b=='\"'||*b=='\\\\')putchar('\\\\');if(*b=='\\n') printf(\"\\\\n\"),b++; else putchar(*b++);}}\nvoid g(char *c){printf(\"%s\", c); putchar('\"'); f(c); printf(\"\\\");}\\n\");}\nint main(){g(");}
@rhaps0dy
rhaps0dy / howto.md
Last active December 11, 2016 12:43
Vote for a charity in Project Awesome

#How to use this?

  1. Go to a charity's page, such as the AMF or the GFI.

  2. Click. one of the videos and vote, normally. This is so you complete the captcha thing.

  3. Go back to the charity page.

  4. Open the browser console.