Skip to content

Instantly share code, notes, and snippets.

Avatar

Karl-Oskar Rikås funrep

View GitHub Profile
@funrep
funrep / dot.mkshrc
Created Sep 17, 2012
doesnt work :(
View dot.mkshrc
PS1=$'\001\r''$(precmd)${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \?
)}@${HOSTNAME%%.*}:$(local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || \
d=${d/#$p/~};'$'\001\e[2;34m\001'' local m=${%d} n p=...; (( m > 0 )) || m=${#d}
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || \
p=; print -nr -- "$$p$d\001\033[0;32m\001") '"$PS1 " $'\001\e[0m\001'
: ${MKSH:=$(whence -p mksh)}; export EDITOR HOSTNAME MKSH TERM USER
View sdfsdf
klr's mksh configuration
: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)}
[[ $HOSTNAME = @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-)
: ${HOSTNAME:=nil}; if (( USER_ID )); then PS1='$'; else PS1='#'; fi
function precmd {
local e=$?
(( e )) && print -n "$e|"
@funrep
funrep / gist:3744548
Created Sep 18, 2012
asdassdasdasadsad
View gist:3744548
error:
foo.c: In function 'main':
foo.c:7:9: warning: unknown escape sequence: '\c' [enabled by default]
code:
/* FOOBAR */
View gist:3751145
/* FOOBAR */
#include <stdio.h>
main()
{
int fuu;
int c;
fuu = ((c=getchar()) != EOF);
View gist:3751341
/* FOOBAR */
#include <stdio.h>
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
View foobar.c
#include <stdio.h>
main()
{
int c;
while ((c = getchar()) != EOF) {
if (c == '\t' || c == '\n')
putchar('\n');
}
View mindfuck.c
#include <stdio.h>
main()
{
int c, i, nwhite, nother;
int ndigit[10]; /* okey, so this make a "array" with 10 variables/values in it? */
nwhite = nother = 0;
for (i = 0; i < 10; ++i)
View gist:3767620
#include <stdio.h>
main()
{
int c, counts[256];
while((c = getchar()) != EOF)
++counts[c];
printf("%d\n", counts[c]);
}
View mindfuck.c
#include <stdio.h>
main()
{
int i, c, counts[256];
for (i = 0; i < 256; ++i)
counts[i] = 0;
while((c = getchar()) != EOF)
View gist:3767859
#include <stdio.h>
main()
{
}