Skip to content

Instantly share code, notes, and snippets.

//(C) Stephan Vedder 2014
#include "BigFile.hpp"
#include <stdexcept>
BigFile::BigEntry::BigEntry() :
name(""), data(""), size(0), offset(0)
{}
BigFile::BigEntry::BigEntry(std::string name, uint32_t size, std::string data) :
name(name), data(data), size(size), offset(0), new_offset(0)
@phrohdoh
phrohdoh / pre-push
Last active December 30, 2016 20:12
git: Prevent WIP commits and use <root>/.last-test file with Makefile `test` target to make sure tests are passing
#!/usr/bin/env bash
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../ && pwd -P)"
# echo "basedir: $BASEDIR"
# REV_PARSE_HEAD="$(git rev-parse --short head)"
# remote="$1"
# url="$2"
# echo "remote: $1"
@phrohdoh
phrohdoh / git-status-recursive
Created December 24, 2016 14:56
git-status-recursive
#!/bin/sh
find . -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && git status -s | grep -q [azAZ09] && echo ---- ${dir//\.git/} ---- && git status -s" ; done
@phrohdoh
phrohdoh / example.sh
Created October 24, 2016 02:00
bash previous arguments
file /usr/local/Cellar/graphviz/2.38.0_1/bin/dot
# /usr/local/Cellar/graphviz/2.38.0_1/bin/dot: Mach-O 64-bit executable x86_64
echo !$ | pbcopy
# echo /usr/local/Cellar/graphviz/2.38.0_1/bin/dot | pbcopy
pbpaste
# /usr/local/Cellar/graphviz/2.38.0_1/bin/dot
["aback","abaft","abandoned","abashed","aberrant","abhorrent","abiding","abject","ablaze","able","abnormal","aboard","aboriginal","abortive","abounding","abrasive","abrupt","absent","absorbed","absorbing","abstracted","absurd","abundant","abusive","acceptable","accessible","accidental","accurate","acid","acidic","acoustic","acrid","actually","ad hoc","adamant","adaptable","addicted","adhesive","adjoining","adorable","adventurous","afraid","aggressive","agonizing","agreeable","ahead","ajar","alcoholic","alert","alike","alive","alleged","alluring","aloof","amazing","ambiguous","ambitious","amuck","amused","amusing","ancient","angry","animated","annoyed","annoying","anxious","apathetic","aquatic","aromatic","arrogant","ashamed","aspiring","assorted","astonishing","attractive","auspicious","automatic","available","average","awake","aware","awesome","awful","axiomatic","bad","barbarous","bashful","bawdy","beautiful","befitting","belligerent","beneficial","bent","berserk","best","better","bewildered","big","billowy
@phrohdoh
phrohdoh / exception.txt
Created September 11, 2016 16:00
OpenRA InstalledMods / InitializeMod KeyNotFoundException (we get key "modchooser" unsafely; no ContainsKey check)
Exception of type `System.Collections.Generic.KeyNotFoundException`: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException () [0x00000] in /private/tmp/mono-20160811-98271-vvenuo/mono-4.4.2/external/referencesource/mscorlib/system/throwhelper.cs:68
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (System.Collections.Generic.TKey key) <0x10a3c0250 + 0x0004a> in <filename unknown>:0
at OpenRA.InstalledMods.get_Item (System.String key) [0x00008] in openra/OpenRA.Game//InstalledMods.cs:126
at OpenRA.Game.InitializeMod (System.String mod, OpenRA.Arguments args) [0x00149] in openra/OpenRA.Game//Game.cs:373
at OpenRA.Game.Initialize (OpenRA.Arguments args) [0x0033d] in openra/OpenRA.Game//Game.cs:322
at OpenRA.Program.Run (System.String[] args) [0x00007] in openra/OpenRA.Game//Support/Program.cs:117
at OpenRA.Program.Main (System.String[] args) [0x00050] in openra/OpenRA.Game//Support/Program.cs:40
From 8ef626d6b9575f6e4dace1bf7bbdcf3c05a4c56b Mon Sep 17 00:00:00 2001
From: evgeniysergeev <evgeniy.sergeev@gmail.com>
Date: Tue, 26 Jul 2016 23:07:56 +0300
Subject: copy changes in chrome from d2k
---
chrome/ingame-infostats.yaml | 82 +++++++++++++++++-------------------
1 file changed, 38 insertions(+), 44 deletions(-)
diff --git chrome/ingame-infostats.yaml chrome/ingame-infostats.yaml
call plug#begin('~/.vim/plugged')
Plug 'git@github.com:itchyny/lightline.vim.git'
Plug 'git@github.com:ctrlpvim/ctrlp.vim.git'
Plug 'git@github.com:tpope/vim-sleuth.git'
Plug 'git@github.com:scrooloose/syntastic.git'
Plug 'git@github.com:kshenoy/vim-signature.git'
Plug 'git@github.com:airblade/vim-gitgutter.git'
Plug 'git@github.com:tpope/vim-dispatch.git', { 'for': 'cs' }
@phrohdoh
phrohdoh / slp.txt
Created July 13, 2016 00:25
Age of Empires 1997 SLP format
What follows is a description of the SLP format.
The actual author wishes to remain unknown, please email bryce@lanset.com with
your questions. However, I did not write this document.
Header
This structure totals 32 bytes and is packed to 1-byte boundaries.
typedef struct Shape_File_Header
{
@phrohdoh
phrohdoh / 1readme.md
Created May 6, 2016 21:08 — forked from akimboyko/1readme.md
ScriptCs as embedded scripting engine for .Net application with NuGet support

ScriptCs as embedded scripting engine for .Net application with NuGet support

This gist contains:

  • ExecuteScriptCs.cs — class that are able to execute ScriptCs from another .Net application
  • ScriptModule.cs — AutoFac configuration for ScriptCs/NuGet dependencies
  • Program.cs — command-line example
  • Sample.csx — sample ScriptCs script
  • packages.config — NuGet packages configuration