Skip to content

Instantly share code, notes, and snippets.

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
@seahrh
seahrh / logback_disable_in_unit_tests.md
Created April 25, 2017 12:06 — forked from traviskaufman/logback_disable_in_unit_tests.md
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@seahrh
seahrh / README.md
Created January 28, 2018 01:22 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

@seahrh
seahrh / easypipe.py
Created May 1, 2018 03:42 — forked from dannguyen/easypipe.py
Using scikit-learn to classify NYT columnists
# some convenience functions here, nothing new
'''
# usage:
from easypipe import easy_pipeline
from easypipe import print_metrics
data_folder = "data-hold/20news"
p = easy_pipeline()
print_metrics(p, data_folder)
'''
@seahrh
seahrh / easypipe.py
Created May 1, 2018 03:42 — forked from dannguyen/easypipe.py
Using scikit-learn to classify NYT columnists
# some convenience functions here, nothing new
'''
# usage:
from easypipe import easy_pipeline
from easypipe import print_metrics
data_folder = "data-hold/20news"
p = easy_pipeline()
print_metrics(p, data_folder)
'''
@seahrh
seahrh / vgg_extract.py
Created September 5, 2018 06:36 — forked from hiwonjoon/vgg_extract.py
Feature Extrcation and Write TF Record example
import numpy as np
import os
import tensorflow as tf
import vgg
import vgg_preprocessing
from pycocotools.coco import COCO
slim = tf.contrib.slim
LOG_DIR = './log/fe'
@seahrh
seahrh / lambda.sh
Created September 26, 2018 08:39 — forked from wrwrwr/lambda.sh
Package a Python module with NumPy and SciPy for AWS Lambda.
#!/usr/bin/env bash
# Path to the project directory (that should include requirements.txt),
# Files and directories within that need to be deployed.
project=../backend
contents=(module lamdba_handler.py)
# Unnecessary parts. Note that there are some inter-dependencies in SciPy,
# for example to use scipy.stats you also need scipy.linalg, scipy.integrate,
# scipy.misc, scipy.sparse, and scipy.special.
@seahrh
seahrh / 0.suffixtree.cs
Created January 18, 2019 02:50 — forked from axefrog/0.suffixtree.cs
C# Suffix tree implementation based on Ukkonen's algorithm. Full explanation here: http://stackoverflow.com/questions/9452701/ukkonens-suffix-tree-algorithm-in-plain-english
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{
@seahrh
seahrh / README.mkd
Created April 25, 2019 02:09 — forked from vrillusions/README.mkd
Generate gpg key via batch file

Introduction

This is how to create a gpg key without any user interaction or password. This can be used in cases where the primary goal is to secure the data in transit but the gpg key can/must be stored locally without a password. An example of this is the hiera-gpg plugin which doesn't support passwords.

The below genkey-batch file will use the default which currently are RSA/RSA and 2048 bit length. See the reference link to set this to something else.

References