Skip to content

Instantly share code, notes, and snippets.

@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:

@h4t0n
h4t0n / .jshintrc
Last active November 7, 2015 08:32
A jshint configuration for nodejs environment
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
@h4t0n
h4t0n / index.js
Created January 5, 2016 12:53 — forked from gergelyke/index.js
callback-with-promise
const fs = require('fs')
function readPackage (callback) {
//as of now we do not have default values in Node.js
callback = callback || function () {}
return new Promise((resolve, reject) => {
fs.readFile('./package.json', (err, data) => {
if (err) {
reject(err)
return callback(err)
@h4t0n
h4t0n / RetweetInfluencer.java
Last active May 4, 2017 21:29
Retweet from Influencer with Spring Boot and Twitter4j
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import twitter4j.*;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@h4t0n
h4t0n / google-dorks
Created May 5, 2017 18:52 — forked from stevenswafford/google-dorks
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@h4t0n
h4t0n / gmaps_hashtag.ipynb
Last active December 17, 2019 00:42
gmaps hashtag jupyter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@h4t0n
h4t0n / GeminiException.java
Last active December 4, 2018 22:35
Spring Error Handling Pattern
public class GeminiException extends Exception {
String errorCodeName;
protected GeminiException(String errorCodeName) {
super(errorCodeName);
this.errorCodeName = errorCodeName;
}
protected GeminiException(String errorCodeName, String message) {
super(message);
@h4t0n
h4t0n / EntityRecordException.java
Created December 5, 2018 22:02
[Gemini] EntityRecordException
public class EntityRecordException extends GeminiException {
public enum Code {
MULTIPLE_LK_FOUND,
LK_NOTFOUND,
INSERTED_RECORD_NOT_FOUND
}
private final Entity entity;
private final Collection<? extends Record.FieldValue> lk;
private final Code errorCode;
@h4t0n
h4t0n / ErrorService.java
Created December 5, 2018 22:48
[Gemini] ErrorService
@Service
public class ErrorService implements InitializingBean {
private List<String> ERROR_CODES = new ArrayList<>();
@Override
public void afterPropertiesSet() throws Exception {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
provider.addIncludeFilter(new AssignableTypeFilter(GeminiException.class));
Set<BeanDefinition> components = provider.findCandidateComponents("it.at7.gemini");
for (BeanDefinition component : components) {