Skip to content

Instantly share code, notes, and snippets.

View mindscratch's full-sized avatar

Craig Wickesser mindscratch

View GitHub Profile
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@mindscratch
mindscratch / cool.component.ts
Created January 8, 2021 15:28
NgRX parameterized selector problem
import { State } from '../shared';
constructor(store: Store<State>) {
// this call to errors because I haven't passed a "state"
store.select(selectNotificationsByGroupType(), { type: this.group.type });
}
@mindscratch
mindscratch / location.guard.spec.ts
Created December 31, 2020 17:35
Angular + Jest Mock Window Location
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { WindowLocationToken } from '../location';
import { LocationHrefGuard } from './location-href.guard';
describe('LocationHrefGuard', () => {
let guard: LocationHrefGuard;
const routeMock: any = {
snapshot: {},
data: { pathname: '/app/logout.php' },
@mindscratch
mindscratch / run_postgres.sh
Created February 2, 2019 17:53
Run postgres in docker for dev
#!/bin/bash
DB_USER=user
DB_PASSWORD=password
DB=demo
DATA_DIR="$(pwd)/postgres-data"
mkdir -p $DATA_DIR
docker run -d -p 5432:5432 \
-e POSTGRES_USER=$DB_USER \
@mindscratch
mindscratch / README.md
Created October 23, 2018 13:32
gradle - download dependencies

$ gradle distZip $ gradle download $ tar cvzf deps.tgz ~/.gradle/caches/modules-2/files-2.1

@mindscratch
mindscratch / env.md
Last active September 10, 2018 21:43
accumulo woes
ACCUMULO_HOME=/opt/accumulo
ACCUMULO_VERSION=2.0.0-SNAPSHOT
APACHE_DIST_URLS=https://www.apache.org/dyn/closer.cgi?action=download&filename=   https://www-us.apache.org/dist/   https://www.apache.org/dist/   https://archive.apache.org/dist/
HADOOP_CONF_DIR=/opt/hadoop/etc/hadoop
HADOOP_HOME=/opt/hadoop
HADOOP_PREFIX=/opt/hadoop
HADOOP_USER_NAME=accumulo
HADOOP_VERSION=2.7.4
HOME=/root
this.connectionManager.start()
this.connectionManager.closeOnShutdown("amqp connection manager").start()
@mindscratch
mindscratch / tcp_flags.txt
Created July 10, 2018 15:39 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@mindscratch
mindscratch / Makefile
Last active February 13, 2019 18:13
Build Thrift Binary on CentOS 7
THRIFT_VERSION=0.11.0
get_dockerfile:
@wget https://raw.githubusercontent.com/apache/thrift/master/build/docker/centos-7.3/Dockerfile
build_image:
@docker build -t thrift .
get_thrift:
@wget http://mirrors.ibiblio.org/apache/thrift/$(THRIFT_VERSION)/thrift-$(THRIFT_VERSION).tar.gz
@mindscratch
mindscratch / input.txt
Last active January 19, 2018 13:03
ner example using NER with Go (https://github.com/sbl/ner/)
This document is about Cal Ripken and Edgar Allen Poe. It's
being written from a house in Carroll County, specifically Union Bridge.
The author is Craig Wickesser.