Skip to content

Instantly share code, notes, and snippets.

View cgmb's full-sized avatar

Cory Bloor cgmb

  • Advanced Micro Devices, Inc.
  • Canada
View GitHub Profile
@cgmb
cgmb / arr_vs_ptr.c
Created September 22, 2015 17:09
Arrays vs pointers in C
#include <stdio.h>
void print_sizeof(char* ptr) {
printf("The passed variable is %u bytes large\n", (unsigned int)sizeof(ptr));
}
int main() {
char arr[] = "Hello World!";
char* ptr = "Hello World!";
@cgmb
cgmb / compile_and_run.sh
Created September 22, 2015 17:19
How to compile an run C program on Solaris
gcc main.c -o hello
./hello
@cgmb
cgmb / .vimrc
Created September 22, 2015 17:22
A .vimrc for csb.cpsc.ucalgary.ca
set nocompatible " Fix arrow keys
set backspace=2 " Use normal backspace behaviour
@cgmb
cgmb / hello.c
Created September 23, 2015 06:52
Hello World in C
#include <stdio.h>
int main() {
printf("Hello World!\n");
return 0;
}
@cgmb
cgmb / calc.c
Created September 23, 2015 07:02
How to use printf and scanf in C
#include <stdio.h>
int main() {
int x, y;
printf("Enter a number: ");
scanf("%d", &x);
printf("Enter another number: ");
scanf("%d", &y);
printf("The sum of %d and %d is %d", x, y, x + y);
return 0;
@cgmb
cgmb / string.c
Created September 23, 2015 07:59
Show that C strings are arrays of numeric values
#include <stdio.h>
int main() {
char hello[] = "Hello World!";
int i;
for (i = 0; i < 13; ++i) {
printf("%c = %d\n", hello[i], (int)hello[i]);
}
return 0;
}
@cgmb
cgmb / main.js
Created January 22, 2016 04:30
A basic example of node-argon2 v0.4.1
var argon2 = require('argon2');
var pass = "password";
var salt = argon2.generateSaltSync();
var hash = argon2.encryptSync(pass, salt, {
timeCost: 3, memoryCost: 12, parallelism: 1
});
console.log(pass);
console.log(hash);
@cgmb
cgmb / main.js
Created January 22, 2016 04:35
A basic example of node-argon2 v0.4.2
var argon2 = require('argon2');
var pass = "password";
var salt = argon2.generateSaltSync();
var hash = argon2.encryptSync(pass, salt, {
timeCost: 3, memoryCost: 12, parallelism: 1
});
console.log(pass);
console.log(hash);
@cgmb
cgmb / 20-intel.conf
Last active July 14, 2019 21:07
Vulkan with Intel Graphics on Ubuntu 14.04
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "DRI" "3"
EndSection
@cgmb
cgmb / cube.log
Last active February 20, 2016 09:24
Ubuntu 14.04 Vulkan Intel Logs (https://gist.github.com/cgmb/7f5ee12c00af5c655235)
incognito@localhost:~/ws/3rdparty/vulkan/VulkanSDK/1.0.3.1/examples/build$ ./cube
WARNING: Haswell Vulkan support is incomplete
anv_device.c:407: FINISHME: Get correct values for VkPhysicalDeviceLimits
gen7_pipeline.c:326: FINISHME: disabling ps
gen7_pipeline.c:326: FINISHME: disabling ps
gen7_pipeline.c:326: FINISHME: disabling ps
gen7_pipeline.c:235: FINISHME: VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
gen7_pipeline.c:235: FINISHME: VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
gen7_pipeline.c:235: FINISHME: VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
gen7_pipeline.c:235: FINISHME: VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO