Skip to content

Instantly share code, notes, and snippets.

View vault's full-sized avatar

Michael Abed vault

  • LogRocket
  • Boston
View GitHub Profile
@vault
vault / access_patterns.c
Created October 19, 2015 22:08
Code demonstrating the impact of memory access patterns on program performance
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <mach/mach_time.h>
void random_fill(int *array, int dim)
{
for (int i = 0; i < dim; i++)
for (int j = 0; j < dim; j++)
diff -aur a/linux.c b/linux.c
--- a/linux.c 2013-07-11 15:58:49.000000000 -0400
+++ b/linux.c 2013-08-24 15:16:13.542185455 -0400
@@ -519,7 +519,7 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
static char *
-mic_devnode(struct device *dev, mode_t *mode)
+mic_devnode(struct device *dev, umode_t *mode)
{
#include <stdio.h>
void *label_value(int really)
{
void *label = &&LABEL;
int x = 2, y = 3;
if (really)
return &&LABEL;
#include <stdio.h>
void *label_value(int really)
{
if (really)
return &&LABEL;
else {
LABEL:
printf("WHY!!!\n");
#include <stdio.h>
unsigned char return_number[] __attribute__((section (".text"))) =
{0x55, 0x48, 0x89, 0xE5, 0xB8, 255, 255,0,0, 0x5D,0xC3 };
int main()
{
int (*fn)(void);
fn = (int(*)(void))&return_number;
printf("%d\n", (*fn)());
#include <stdio.h>
void* justwait(int selector)
{
if (selector)
{
printf("%d\n", 1+1);
DEARGOD:
printf("%d\n", 2+2);
printf("%d\n", 3+3);
@vault
vault / log1
Created January 29, 2013 05:27
michael on li361-142 in ~
$ /bin/cat
-bash: /bin/cat: No such file or directory
michael on li361-142 in ~
$ ls
-bash: /bin/ls: No such file or directory
michael on li361-142 in ~
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
<debug enable="1" />
<volume user="*" fstype="cifs" server="eng-home" path="%(exec userpath %(USER))" mountpoint="~" />
<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
<mntoptions require="nosuid,nodev" />
<path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin</path>
<logout wait="0" hup="0" term="0" kill="0" />
<mkmountpoint enable="1" remove="true" />
<style>
body {
margin: 0;
padding: 0;
}
iframe {
margin: 0;
padding: 0;
}
#include <stdio.h>
void* justwait(int selector)
{
if (selector)
{
DEARGOD:
printf("%d\n", 2+2);
return NULL;
}