Skip to content

Instantly share code, notes, and snippets.

@alex-eg
alex-eg / platform-var.el
Created May 7, 2018 22:13
elisp platform-set-variable
(defvar *var-plist* (list))
(defmacro platform-var (name &rest plist)
(let ((plist-keys (mapcar 'car (seq-partition plist 2)))
(platforms '(:gnu :gnu/linux :gnu/kfreebsd :darwin :ms-dos :windows-nt :cygwin)))
(mapcar (lambda (key)
(when (not (member key platforms))
(error "Platform `%s' doesn't exist. Possible values: `%s'" key platforms)))
plist-keys)
(setq *var-plist* (plist-put *var-plist* name plist))
alex@virtdebian ~/dev $ cat wut.awk
{ print $1 ",'" $2 "','" $3 "','" $4 "','" $5 "','" $6 "'," $7 ",'" $8 "'," $9 "," $10 }
alex@virtdebian ~/dev $ cat in.txt
1,2,3,4,5,6,7,8,9,0
a,b,c,d,e,f,g,h,j,i
foo,bar,baz,quux,zot,zap,qwe,asdf,uiop,plop
alex@virtdebian ~/dev $ awk -F, -f wut.awk in.txt
1,'2','3','4','5','6',7,'8',9,0
Mesa: User error: GL_INVALID_ENUM in glBindBufferARB(target GL_UNIFORM_BUFFER)
Mesa: User error: GL_INVALID_ENUM in glBufferData(target)
...
Mesa: User error: GL_INVALID_OPERATION in glGetUniformBlockIndex
Mesa: User error: GL_INVALID_OPERATION in glUniformBlockBinding
...
Mesa: User error: GL_INVALID_ENUM in glBindBufferARB(target GL_UNIFORM_BUFFER)
Mesa: User error: GL_INVALID_ENUM in glBufferData(target)
641 @0 glGenFramebuffers(n = 1, framebuffers = &0)
641: warning: no current context
642 @0 glBindFramebuffer(target = GL_FRAMEBUFFER, framebuffer = 0)
642: warning: no current context
643 @0 glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_COLOR_ATTACHMENT0, textarget = GL_TEXTURE_2D, texture = 0, level = 0)
643: warning: no current context
644 @0 glCheckFramebufferStatus(target = GL_FRAMEBUFFER) = GL_ZERO
644: warning: no current context
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
int main(void) {
off_t offset = 0;
size_t size=33554432;
int open_flags = O_RDWR;
int prot = PROT_READ | PROT_WRITE;
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
int i = 0;
jmp_buf jump_buffer;
void sigsegv_handler(int signum) {
printf(" Ignoring SIGSEGV is a bad idea\n");
longjmp(jump_buffer, 1);
// cc -o fun pthreads-megafun.c -g -std=c99 -lpthread
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
static void *start(void *arg) {
int code = (int)arg;
#!/bin/bash
user="minecraft"
session="mc-session"
serv_dir="/home/minecraft/server/"
usage() {
echo "Minecraft control tool"
echo "Usage:"
echo " start [minecraft-server.jar] start server"
(defconstant +debruijn64+ #x22fdd63cc95386d)
(defvar *bit-table*
(let ((a (make-array 64 :element-type '(unsigned-byte 8))))
(loop for i from 0 below 64 do
(setf (aref a (ash (logand #xFFFFFFFFFFFFFFFF
(ash +debruijn64+ i)) -58)) i))
a))
(defun ctz (x)
(declare (type (unsigned-byte 64) x))
(defmacro case-char (c &body body)
(let ((conditions (mapcar (lambda (branch)
(list (list 'char= c (car branch))
(cadr branch)))
body)))
`(cond ,@conditions)))