Skip to content

Instantly share code, notes, and snippets.

💭
Game devving 24/7

Mathias Westerdahl JCash

💭
Game devving 24/7
Block or report user

Report or block JCash

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JCash
JCash / Dockerfile
Created Aug 16, 2019
Ubuntu 18 Docker container for building C++
View Dockerfile
#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 && \
@JCash
JCash / main.cpp
Created Aug 11, 2019
Atrix256's debug container test
View main.cpp
// 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 / vscode.sh
Created Jul 29, 2019
Create a Visual Studio Code "project" on the fly, given an executable, then launching the project
View vscode.sh
#! /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 / binary2header.py
Created Jul 10, 2019
Create C/C++ embeddable header from binary file
View binary2header.py
#! /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 / compile_webp_encoder.sh
Created Jun 6, 2019
A simple way to compile the WebP encoder, since the vanilla makefiles fail on OSX
View compile_webp_encoder.sh
#!/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 / osxcross_build.sh
Last active Nov 18, 2018
A modified version of osxcross/build.sh. Build with "SDK_VERSION=10.11 ./build.sh"
View osxcross_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 / cctools-dlfcn.patch
Last active Dec 1, 2018
A patch file to use with osxcross, to avoid a compile error. Modify build.sh to apply this patch too
View cctools-dlfcn.patch
--- 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 / scan_build_gather_report.py
Last active Jul 21, 2018
If you have several folders with scan_build results, you can merge them together with this script, into one big report
View scan_build_gather_report.py
#! /usr/bin/env python
import os
import re
import sys
import shutil
import argparse
from collections import defaultdict
INDEX_HTML = """
@JCash
JCash / array.cpp
Last active Jan 16, 2018
std::vector vs jc::Array test
View array.cpp
#include <stdio.h>
#include <stdlib.h>
#if defined(STL)
#include <vector>
int Calc(int count)
{
std::vector<int> numbers;
@JCash
JCash / touchscreen.ino
Created Aug 29, 2017
Arduino touch screen example using Nintendo 2DS screen
View touchscreen.ino
// Touch screen example for arduino using a Nintendo 2ds touch screen
// Code is mostly inspired from http://tronixstuff.com/2010/12/29/tutorial-arduino-and-the-ds-touch-screen/
// and the Adafruit touch screen library
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
You can’t perform that action at this time.