Skip to content

Instantly share code, notes, and snippets.

View 0x1mason's full-sized avatar

Eric Millin 0x1mason

  • IBM
  • Durm, Cackalack del Norte
View GitHub Profile
@0x1mason
0x1mason / Ground.cs
Last active December 26, 2017 03:15
ground
using System.Collections.Generic;
namespace Andrey
{
public enum Terrain
{
Forest,
MountainForest,
Marsh,
Desert,
diff --git a/src/grib_context.c b/src/grib_context.c
index d4f5a34..d59b7f3 100644
--- a/src/grib_context.c
+++ b/src/grib_context.c
@@ -1018,8 +1018,12 @@ void codes_assertion_failed(const char* message, const char* file, int line)
/* Default behaviour is to abort
* unless user has supplied his own assertion routine */
if (assertion == NULL) {
+ grib_context* c = NULL;
+ c = grib_context_get_default();
@0x1mason
0x1mason / lock.patch
Created July 25, 2017 00:54
omp lock patch
diff --git a/grib_api/src/grib_context.c b/grib_api/src/grib_context.c
index ecfd1a5..384f005 100644
--- a/grib_api/src/grib_context.c
+++ b/grib_api/src/grib_context.c
@@ -341,6 +341,8 @@ static grib_context default_grib_context = {
0 /* classes */
#if GRIB_PTHREADS
,PTHREAD_MUTEX_INITIALIZER /* mutex */
+#elif GRIB_OMP_THREADS
+ ,0 /* omp_nest_lock_t */
function getBranch {
git symbolic-ref --short HEAD 2> /dev/null
if [ $? == 0 ] && [ `git rev-parse --is-inside-work-tree`==true ]; then
echo "(`git symbolic-ref --short HEAD`)"
fi
}
function setPrompt {
GIT_EXEC_PATH=/c/tools/cmder/vendor/git-for-windows/mingw64/
COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
@0x1mason
0x1mason / pre-push.sh
Created January 18, 2016 15:18 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@0x1mason
0x1mason / Instructions.md
Created January 16, 2016 22:55 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

/// <summary>
/// Generator that allows lazy access to paginated resources.
/// </summary>
/// <typeparam name="TValue"></typeparam>
/// <param name="overrideUrl"></param>
/// <param name="pageLen"></param>
/// <returns></returns>
protected IEnumerable<List<TValue>> IteratePages<TValue> (string overrideUrl, int pageLen = DEFAULT_PAGE_LEN) {
Debug.Assert(!String.IsNullOrEmpty(overrideUrl));
Debug.Assert(!overrideUrl.Contains("?"));
@0x1mason
0x1mason / gist:5c9dd03c22fd765fec5e
Last active April 21, 2018 22:42
Chromium Build Setup
apt-get update
apt-get install -qy git clang
mkdir ~/chromium
cd ~/chromium
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "export DEPOT_TOOLS=\"\$HOME/chromium/depot_tools\"" >> ~/.bashrc
echo "export PATH=\"\$PATH:$DEPOT_TOOLS\"" >> ~/.bashrc
@0x1mason
0x1mason / socket.js
Last active August 29, 2015 14:11
hackathon socket magic
var net = require("net");
var exec = require('child_process').exec;
var ADB = require('appium-adb');
//var adb = new ADB();
var template = '{"action":"Prepare", "cmd":"foo"}';
// var args = process.argv.slice(2).join(' ');
// adb.getConnectedDevices(function(err, devices) {
// in helpers.js
Object.prototype.forOf = function(iterateFunc) {
var keys = Object.keys(this),
continueLoop = true;
var breakLoop = () => continueLoop = false;
for(var counter = 0; counter < keys.length && continueLoop; counter++) {
iterateFunc(this, keys[counter], breakLoop);
}
};