Skip to content

Instantly share code, notes, and snippets.

View enesser's full-sized avatar

Eric J Nesser enesser

View GitHub Profile
@enesser
enesser / domReady.js
Last active October 26, 2016 22:26
JavaScript helpers -- vanilla JS alternatives to jQuery. (es6, modularized)
/**
* @license domReady 2.0.1 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/domReady/LICENSE
*/
/* jshint node: true */
'use strict';
var isTop, testDiv, scrollIntervalId,
@enesser
enesser / convert-geometry-to-bufferGeometry-threejs.js
Created October 7, 2016 17:40
Convert threejs geometry to bufferGeometry; setup an array for vertex displacement
let bufferGeometry = new THREE.BufferGeometry().fromGeometry(model.geometry);
let displacement = new Float32Array(bufferGeometry.attributes.position.count);
bufferGeometry.addAttribute('displacement', new THREE.BufferAttribute( displacement, 1));
@enesser
enesser / elasticsearch.sh
Last active December 6, 2018 21:28
Common Elasticsearch Commands
# most of these examples assume a simple course entity as follows
{
name: "Course Name",
tags: ["tag1", "tag2"]
}
# create a mapping for "course" in the index "courses" specifying name and tags field using heredoc
$ curl -XPUT -d@- 'localhost:9200/courses/_mapping/course?pretty' <<EOF
{
"properties": {
@enesser
enesser / makeadmin
Created August 17, 2016 20:14
Make a Mac OS X account an admin
dseditgroup -o edit -a (user name) -t user admin
@enesser
enesser / parentpid.sh
Created December 8, 2015 23:05
Find parent PID of a PID
# find parent PID alias
# usage: $parentpid (pid)
alias parentpid="ps -o ppid= -p"
@enesser
enesser / something.js
Created October 14, 2015 18:54 — forked from aheckmann/something.js
mongoose: emit update or create
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
mongoose.connect('localhost', 'testing_emitUpdate');
var schema = new Schema({
name: String
});
schema.pre('save', function (next) {
@enesser
enesser / GIF-Screencast-OSX.md
Last active August 31, 2015 07:49 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@enesser
enesser / mem.sh
Created June 17, 2015 20:48
Show memory usage (and PID, % CPU, command) for a process by name
# memory usage, usage: mem (procss name)
mem() {
echo|awk '{print "PID" "\tCPU" "\tMEM" "\tCMD"}'
top -l 1|ack "$1"|awk '{print $1 "\t"$3 "\t"$8 "\t"$2}'
}
@enesser
enesser / main.js
Last active August 29, 2015 14:22 — forked from donnut/main.js
var mongoose = require('mongoose'),
assert = require('assert')
mongoose.connect('localhost/mydb');
var Schema = mongoose.Schema;
var ContainerSchema = new Schema({
name: String,
})
/****************************************
* GSALib Wrapper for Google Search Appliance
* GSA.Paragon.Utils
* Written by Jon Upchurch
* Copyright 2013 by Paragon Consulting, Inc.
* Free to use, distribute, and modify
* with this credit comment retained.
****************************************/
using GSALib.Constants;
using GSALib.GSA;