Skip to content

Instantly share code, notes, and snippets.

@croepha
croepha / gist:d006ec1f62dd4dcb1774c5116d1cebff
Created October 28, 2016 15:47
custom ubuntu core config:
sudo /snap/bin/ubuntu-image \
--extra-snaps=/home/cro/home_root/mnt/2/snapcraft_kernel_build_test/linuxium-kernel_4.4.0-45.66_amd64.snap \
-c beta -o ${DIR2_}/ics-ubuntu-image.img \
${DIR4_}/ics.model
LOOP_DEVICE=$(sudo losetup --partscan --find --show \
${DIR2_}/ics-ubuntu-image.img)
sudo mount ${LOOP_DEVICE}p3 ${DIR4_}/custom_image
#if 0 /* (sh-mode)
set -e
LPATH=/Users/cro/Documents/PersonalProjects/Graphics/
# -Ofast
[ ! ]&& time clang++ -g --std=c++11 -fPIC -Wall \
$LPATH/text_test.cpp \
-Wno-writable-strings \
-Wno-unused-function \
@croepha
croepha / main.cpp
Created December 15, 2016 18:09
Example of calling into the kernel vdso directly
#include <stdio.h>
#include <sys/auxv.h> // For getauxval and AT_SYSINFO_EHDR
#include <string.h>
#include <elf.h>
typedef unsigned char u8;
void* vdso_sym(char* name) {
// in order to semantically inline getauxval one would have to bypass glibc, as the auxval is passed
// by the kernel to the bin's entrypoint used by the kernel
#if 0 /* (sh-mode)
set -e
LPATH=/Users/cro/Documents/PersonalProjects/Graphics/
tu_name=cube_rotate_thing
# -Ofast
[ ! ]&& time clang++ -g --std=c++11 -fPIC -Wall \
-D "RELOADABLE_CODE=\"$LPATH${tu_name}_reloadable.cpp.so\"" \
@croepha
croepha / gl_vlc_test.cpp
Created January 2, 2017 09:44
Lib vlc testing
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mutex.h>
@croepha
croepha / stb_printf_test.cpp
Created January 22, 2017 21:12
Example of doing normal printf with Jeff Robert's sprintf
#if 0 /* (sh-mode)
set -e
LPATH=/Users/cro/Documents/PersonalProjects/Misc
tu_name=stb_printf_test
# -Ofast
[ ! ]&& time clang++ -g --std=c++11 -fPIC -Wall \
$LPATH/${tu_name}.cpp \
@croepha
croepha / sk_devenv_stop_debug.cpp
Last active May 2, 2017 19:21
Stops the visual studio debugger, useful for putting in your build scripts and avoid the exe file in use issues
#include <stdio.h>
#include <Windows.h>
BOOL EnumWindowsProc_(HWND hwnd, LPARAM lParam ) {
char text_buff[1024] = "";
GetWindowTextA(hwnd, text_buff, sizeof(text_buff));
if (strstr(text_buff, "Microsoft Visual Studio")) {
printf("%p\n", hwnd);
printf("%s\n", text_buff);
from launchpadlib.launchpad import Launchpad
from launchpadlib.uris import lookup_service_root
instance = lookup_service_root('production')
launchpad = Launchpad.login_with('lp-shell', instance, version='devel')
loaded = launchpad.load('/~snappy-dev/+snap/core')
for build in loaded.builds:
if build.store_upload_revision == 1689:
break
for manifest in build.getFileUrls():
@croepha
croepha / test10.cpp
Created June 15, 2017 19:05
super crappy meta compiler
#if 0
set -x
#remote ubuntu-vmw
#release_mode=1
skip_meta
skip_test=1
#// test_source=/mnt/hgfs/cro/Documents/Shared/cro_meta_build/test_source.cpp
#// test_args $test_source $test_source.meta_out.cpp
#// EXTRA_COMMANDS="time clang++-3.8 -g --std=c++11 -I /mnt/hgfs/cro/Documents/Shared/ -Wno-writable-strings $test_source.meta_out.cpp -o $test_source.bin; time $test_source.bin"
run_next="test_source.cpp"
@croepha
croepha / Chapter_000_Introduction.cpp
Last active May 11, 2022 06:04
Croepha's guide to computer programming [VERY EARLY DRAFT EVERYTHING SUBJECT TO CHANGE]
/*
TODO: Need to work on language so that ESL and Children would have easier time reading
Summary Paragraph:
This is a guide for people who have little or no computer programming
experience but aspire to create excellent and high quality software.
We will cover everything to get you started, including getting your
computer ready for programming and talking about some basic concepts.
Eventually we will work our way onto making quite sophisticated programs.