Skip to content

Instantly share code, notes, and snippets.

@rg3
rg3 / combs.cc
Created Dec 7, 2010
Simple code to create combinations in C++
View combs.cc
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using std::copy;
using std::cout;
using std::endl;
using std::vector;
@rg3
rg3 / combs_repeat.cc
Created Dec 7, 2010
Simple code to show how to create combinations with repetitions in C++
View combs_repeat.cc
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using std::copy;
using std::cout;
using std::endl;
using std::vector;
@rg3
rg3 / perms.cc
Created Dec 7, 2010
Simple code to show how to generate permutations in C++
View perms.cc
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using std::copy;
using std::cout;
using std::endl;
using std::vector;
@rg3
rg3 / hello.sh
Created Dec 29, 2010
Shell script that created the hello.png image
View hello.sh
#!/bin/sh
convert -density 72x72 -size 10000x5000 xc:white \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+1020 '#include <stdio.h>' \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+1740 'int main(void)' \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+2100 '{' \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+2460 ' printf(\"Hello, World!\\n\");' \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+2820 ' return 0;' \
-font Liberation-Mono-Regular -pointsize 360 -fill grey -annotate +1120+6340 '}' \
-font Liberation-Sans-Bold -pointsize 160 -fill \#eeccff -annotate +5020+4020 'Dennis M. Ritchie' \
-font Liberation-Sans-Italic -pointsize 160 -fill \#eeccff -annotate +5020+4180 'The C Programming Language, Second Edition' \
View keybase.md

Keybase proof

I hereby claim:

  • I am rg3 on github.
  • I am rg3 (https://keybase.io/rg3) on keybase.
  • I have a public key whose fingerprint is 3E9A 8D56 E7B7 2DF3 65DF D81F 55D9 266C 0CC6 9CED

To claim this, I am signing this object:

@rg3
rg3 / vulkan-invalid-stype.cpp
Created Feb 17, 2021
Vulkan program using invalid sType value
View vulkan-invalid-stype.cpp
#include <vulkan/vulkan.h>
#include <iostream>
int main(void)
{
VkInstance instance = VK_NULL_HANDLE;
const VkApplicationInfo appInfo =
{