Skip to content

Instantly share code, notes, and snippets.

Avatar

Joey Geiger jgeiger

View GitHub Profile
@jgeiger
jgeiger / nginx.conf
Last active December 24, 2021 06:23
Nginx base config
View nginx.conf
user www-data;
worker_processes 2;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
use epoll;
}
@jgeiger
jgeiger / sysctl.conf
Last active January 27, 2021 08:51
Tweaked sysctl.conf for ubuntu
View sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
@jgeiger
jgeiger / monit.conf
Created August 11, 2014 04:50
Monit upstart script
View monit.conf
description "Monit service manager"
limit core unlimited unlimited
start on runlevel [2345]
stop on runlevel [!2345]
expect daemon
respawn
@jgeiger
jgeiger / Makefile
Created January 28, 2016 15:49
Default Makefile for building Go projects including Docker containers
View Makefile
SHELL := /bin/bash
PROJECT := github.com/jgeiger/example
PKGS := $(shell go list ./... | grep -v /vendor)
EXECUTABLE := example
PKG := example
DOCKER_REGISTRY := jgeiger
DOCKER_IMAGE_NAME := example
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
.PHONY: build test golint docs $(PROJECT) $(PKGS) vendor
@jgeiger
jgeiger / timecapsule-handler
Created September 15, 2017 18:46 — forked from dgraziotin/timecapsule-handler
Script to automatically look for Apple TimeCapsule devices and mount/umount them under GNU/Linux. See http://task3.cc/418/how-to-automatically-mount-and-umount-apple-time-capsule-on-linu for info and explanations.
View timecapsule-handler
#!/bin/bash
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
# Version 3, enhanced for Ubuntu 13.X+, Fedora 19+, and similar distros.
View keybase.md

Keybase proof

I hereby claim:

  • I am jgeiger on github.
  • I am jgeiger (https://keybase.io/jgeiger) on keybase.
  • I have a public key whose fingerprint is 881A 1844 D71E 5741 C36E C5BD F733 E075 2CE8 36DF

To claim this, I am signing this object:

@jgeiger
jgeiger / snippet.rb
Created April 22, 2011 18:56
using redis to reserve a set of records from a larger group
View snippet.rb
def find_for_curation(conditions, user_id)
RedisConnection.db.sadd('curators', user_id)
RedisConnection.db.del("curator-#{user_id}")
curator_ids = RedisConnection.db.smembers('curators')
curator_keys = curator_ids.map { |id| "curator-#{id}" }
active_annotation_ids = RedisConnection.db.sunion(*curator_keys)
annotations = Annotation.where(conditions).where("annotations.id NOT IN (#{active_annotation_ids.to_in_query_string})").joins(:ontology_term).joins(:ontology).limit(15).order('ontology_terms.name')
annotations.each do |annotation|
RedisConnection.db.sadd("curator-#{user_id}", annotation.id)
end
View cronjob.text
# create a new cron job at panel.dreamhost.com and run it daily (which will be midnight)
/home/account/opt/bin/logrotate -f -s /home/account/opt/lib/logrotate.status /home/account/opt/etc/logrotate.conf
View .bashrc
export PATH=$HOME/.gems/bin:$HOME/opt/bin:$PATH
export GEM_HOME=$HOME/.gems
export GEM_PATH="$GEM_HOME"
export RUBYLIB="$HOME/opt/lib:$RUBYLIB"
alias gem="nice -n19 ~/opt/bin/gem"
View visual_password_check.js
$("#new_user #user_password").passwordCheck();
jQuery.fn.passwordCheck = function() {
var pass = $(this[0]) // It's your element
var noofchar=/^.*(?=.{6,}).*$/;
var checkspace=/\s/;
var best=/^.*(?=.{6,})(?=.*[A-Z])(?=.*[\d])(?=.*[\W]).*$/;
var strong=/^[a-zA-Z\d\W_]*(?=[a-zA-Z\d\W_]{6,})(((?=[a-zA-Z\d\W_]*[A-Z])(?=[a-zA-Z\d\W_]*[\d]))|((?=[a-zA-Z\d\W_]*[A-Z])(?=[a-zA-Z\d\W_]*[\W_]))|((?=[a-zA-Z\d\W_]*[\d])(?=[a-zA-Z\d\W_]*[\W_])))[a-zA-Z\d\W_]*$/;
var weak=/^[a-zA-Z\d\W_]*(?=[a-zA-Z\d\W_]{6,})(?=[a-zA-Z\d\W_]*[A-Z]|[a-zA-Z\d\W_]*[\d]|[a-zA-Z\d\W_]*[\W_])[a-zA-Z\d\W_]*$/;
var bad=/^((^[a-z]{6,}$)|(^[A-Z]{6,}$)|(^[\d]{6,}$)|(^[\W_]{6,}$))$/;