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 / jcash.zsh-theme
Created May 26, 2022 08:41
Put in ~/.oh-my-zsh/custom/jcash.zsh-theme , Set ZSH_THEME="jcash" in ~ /.zshrc
eval fff='$FG[231]'
eval eee='$FG[252]'
eval ccc='$FG[007]'
eval gray='$FG[237]'
eval orange='$FG[214]'
eval lightorange='$FG[178]'
eval green='$FG[064]'
eval lightgreen='$FG[113]'
eval red='$FG[001]'
eval lightred='$FG[196]'
@JCash
JCash / strip_lib.h
Created January 8, 2021 15:52
Unpacks a static library (.a) and strips all the debug symbols, then repacks the library again. Overwrites original file!
#!/bin/bash
# usage: repack.sh file.a
# used on macOS
# Originally from https://stackoverflow.com/a/49632127/468516
if [ -z "$1" ]; then
echo "usage: repack file.a"
exit 1
fi
@JCash
JCash / README.md
Last active December 29, 2020 18:40
signal handler + test cases (gcc -g test.c) (testing on macOS)

build

$ gcc -g test.c

Types of crashes:

  • TEST_ABORT=1 (calls assert(false))
  • TEST_SEGV=1 (generates a segv)
  • (no test type) (just generates a callstack())
@JCash
JCash / Makefile
Last active October 14, 2024 09:21
How to print the correct, offending callstack
CXXFLAGS := \
-O0 -g -Wall \
-march=native -mtune=native \
-I/usr/local/opt/libunwind-headers/include
ifeq ($(shell uname), Linux)
LDFLAGS := -lunwind
endif
TARGETS := \
@JCash
JCash / build.yml
Last active March 2, 2020 13:41
Setting up Win32 build pipeline in Docker
x86_64-win32:
env:
TMP: "{{build_folder}}"
TEMP: "{{build_folder}}"
MSVC_DIR: "{{env.WINDOWS_MSVC_2019_DIR}}"
SDK8_DIR: "{{env.WINDOWS_SDK_8_DIR}}"
SDK10_DIR: "{{env.WINDOWS_SDK_10_DIR}}"
SDK10_VERSION: "{{env.WINDOWS_SDK_10_VERSION}}"
VCINSTALLDIR: "{{env.WINDOWS_VCINSTALLDIR}}"
[
// Fix End of line
{ "keys": ["ctrl+right"], "command": "move_to", "args": {"to": "hardeol", "extend": false} }
,{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "hardeol", "extend": false} }
// Fix Beginning of line
,{ "keys": ["ctrl+left"], "command": "move_to", "args": {"to": "hardbol", "extend": false} }
,{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "hardbol", "extend": false} }
// Fix end of line + select
,{ "keys": ["ctrl+shift+right"], "command": "move_to", "args": {"to": "hardeol", "extend": true} }
// Fix beginning of line + select
#!/bin/bash
####################################################
# Connect to running AWS instances using tag names #
# Author: henrik.enblom@uniqode.se #
####################################################
PEM_FILE="$HOME/.ssh/aws.pem";
DEFAULT_USERNAME="ubuntu";
@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 && \
@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 / 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'