Skip to content

Instantly share code, notes, and snippets.

@itzg
itzg / build.gradle
Last active January 16, 2022 10:03
If you have one application jar with several main entry point classes, you can have Gradle produce a wrapper script for as many of those as you need.
apply plugin: 'groovy'
apply plugin: 'application'
startScripts.deleteAllActions()
jar {
manifest {
// Make sure the app's jar can be used with a simple -cp
attributes 'Class-Path': configurations.runtime.collect { "${it.getName()}" }.join(' ')
}
@mpalmerlee
mpalmerlee / documentModel.js
Last active April 2, 2018 21:12
Save MongoDB Document With Concurrent Edit Protection
var mongoose = require("mongoose");
var ObjectId = mongoose.Schema.Types.ObjectId;
//create schema for a post
var PostSchema = new mongoose.Schema({
nonce: ObjectId, //this is used for protecting against concurrent edits: http://docs.mongodb.org/ecosystem/use-cases/metadata-and-asset-management/
name: String,
dateCreated: { type: Date, default: Date.now },
dateLastChanged: { type: Date, default: Date.now },
postData: mongoose.Schema.Types.Mixed
@stevenswafford
stevenswafford / google-dorks
Created June 6, 2015 05:57
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@h4t0n
h4t0n / osx_brew_mongo_output.txt
Last active October 22, 2015 20:20
Default launcher for mongodb on OSX - output of brew install mongodb
# To have launchd start mongodb at login:
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
# Then to load mongodb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
# Or, if you don't want/need launchctl, you can just run:
mongod --config /usr/local/etc/mongod.conf
@h4t0n
h4t0n / highlight.md
Created October 10, 2015 20:14 — forked from ashrithr/highlight.md
Syntax highlight in Keynote

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: