Skip to content

Instantly share code, notes, and snippets.

View JCash's full-sized avatar
💭
Game devving 24/7

Mathias Westerdahl JCash

💭
Game devving 24/7
View GitHub Profile
@JCash
JCash / array.cpp
Last active January 16, 2018 19:31
std::vector vs jc::Array test
#include <stdio.h>
#include <stdlib.h>
#if defined(STL)
#include <vector>
int Calc(int count)
{
std::vector<int> numbers;
@JCash
JCash / scan_build_gather_report.py
Last active July 21, 2018 15:04
If you have several folders with scan_build results, you can merge them together with this script, into one big report
#! /usr/bin/env python
import os
import re
import sys
import shutil
import argparse
from collections import defaultdict
INDEX_HTML = """
@JCash
JCash / cctools-dlfcn.patch
Last active December 1, 2018 11:22
A patch file to use with osxcross, to avoid a compile error. Modify build.sh to apply this patch too
--- include/foreign/dlfcn_backup.h 2018-11-18 21:22:45.000000000 +0100
+++ include/foreign/dlfcn.h 2018-11-18 21:23:00.000000000 +0100
@@ -3,7 +3,7 @@
#include_next <dlfcn.h>
#include <stdio.h> /* stderr */
#ifdef __CYGWIN__
-typedef struct dl_info {
+/*typedef struct dl_info {
const char *dli_fname;
void *dli_fbase;
@JCash
JCash / osxcross_build.sh
Last active November 18, 2018 22:04
A modified version of osxcross/build.sh. Build with "SDK_VERSION=10.11 ./build.sh"
#!/usr/bin/env bash
#
# Build and install the cctools the SDK and macports.
#
# This script requires the OS X SDK and the Clang/LLVM compiler.
#
pushd "${0%/*}" &>/dev/null
@JCash
JCash / compile_webp_encoder.sh
Created June 6, 2019 14:34
A simple way to compile the WebP encoder, since the vanilla makefiles fail on OSX
#!/usr/bin/env bash
CC=clang
CCFLAGS="-c -I./libwebp-1.0.2"
function compile {
local DIR=$1
local NAME=$2
for file in `ls $DIR/*.c`; do
echo $file
@JCash
JCash / binary2header.py
Created July 10, 2019 11:25
Create C/C++ embeddable header from binary file
#! /usr/bin/env python
import sys, os
def Usage():
print "Usage: ./binary2header.py <file>"
if __name__ == '__main__':
if len(sys.argv) < 2:
Usage()
@JCash
JCash / vscode.sh
Created July 29, 2019 08:44
Create a Visual Studio Code "project" on the fly, given an executable, then launching the project
#! /usr/bin/env bash
# DISCLAIMER:
# This code IS WITHOUT ANY WARRANTY!
# Use at own risk
FOLDER='.vscode'
LAUNCH_FILE='launch.json'
MAGIC_FILE='vscode_script'
@JCash
JCash / main.cpp
Created August 11, 2019 08:27
Atrix256's debug container test
// the size of the image that is made into mips
#define IMAGE_SIZE() 512
typedef float ChannelType;
#include <stdio.h>
#include <array>
#include <vector>
#include <chrono>
#include "array.h"
@JCash
JCash / Dockerfile
Created August 16, 2019 07:35
Ubuntu 18 Docker container for building C++
#FROM i386/ubuntu:18.04
FROM ubuntu:18.04
# Base stuff
RUN \
apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
#!/bin/bash
####################################################
# Connect to running AWS instances using tag names #
# Author: henrik.enblom@uniqode.se #
####################################################
PEM_FILE="$HOME/.ssh/aws.pem";
DEFAULT_USERNAME="ubuntu";