Skip to content

Instantly share code, notes, and snippets.

View arleighdickerson's full-sized avatar
🦊
Returning to Westinghouse in the fall. Go Bulldogs! 🐶🤓🤠

Arleigh Dickerson arleighdickerson

🦊
Returning to Westinghouse in the fall. Go Bulldogs! 🐶🤓🤠
View GitHub Profile
@dholbrook
dholbrook / SleepingBarber.scala
Created October 12, 2011 03:03
Sleeping Barber Problem, Akka actor implementation
import java.lang.Thread
import scala.collection.mutable.Queue
import akka.actor.Uuid
import akka.actor.scala2ActorRef
import akka.actor.Actor
import akka.event.EventHandler
/*
* Sleeping Barber Code Club Problem
* See (http://en.wikipedia.org/wiki/Sleeping_barber_problem)
@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@extraordinaire
extraordinaire / reconnecting_pdo.php
Last active June 27, 2023 11:12
Reconnectable PDO
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
#! /usr/bin/env php
<?php
/* PHP Slowloris
* Adapted from the script found here: http://seclists.org/fulldisclosure/2009/Jun/207
* Contains get based attack (slow headers) and post based attack (long content length)
*
* Author: Seppe vanden Broucke
*/
function usage($argv){
@mariussoutier
mariussoutier / JsonFormats.scala
Last active December 6, 2016 07:19
ReactiveMongo Play Plugin Extensions
package json
import reactivemongo.bson._
import reactivemongo.bson.handlers.DefaultBSONHandlers._
import play.api.libs.json._
import play.api.libs.json.Json._
import play.api.libs.json.util._
import play.api.libs.json.Writes._
import play.api.libs.functional.syntax._
@mpilone
mpilone / VaadinSecurityContext.java
Created July 31, 2013 15:00
Vaadin, Shiro, and Push. Support classes to integrate Shiro with Vaadin 7.1+ push support. See http://mikepilone.blogspot.com/ for more information.
package org.mpilone.util.shiro;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.mgt.DefaultSecurityManager;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;
import org.mpilone.util.shiro.SecurityContext;
import com.vaadin.server.VaadinSession;
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@fullstackto
fullstackto / Responsive canvas redrawing of Chart.js using jQuery
Created February 27, 2014 21:32
Responsive canvas redrawing of Chart.js using jQuery
var width = $('canvas').parent().width();
$('canvas').attr("width",width);
new Chart(ctx).Line(data,options);
window.onresize = function(event){
var width = $('canvas').parent().width();
$('canvas').attr("width",width);
new Chart(ctx).Line(data,options);
};
@NTICompass
NTICompass / moment.phpDateFormat.js
Last active May 25, 2018 02:15
Use PHP's date() formats in moment.js
(function(m){
/*
* PHP => moment.js
*
* http://www.php.net/manual/en/function.date.php
* http://momentjs.com/docs/#/displaying/format/
*/
var formatMap = {
d: 'DD',
D: 'ddd',
@mikehaertl
mikehaertl / README.md
Last active September 19, 2022 21:20
How to develop with docker and Yii2

Docker Development Workflow

These ideas are WORK IN PROGRESS!

Summary

The core idea with this workflow is that we end up with a self contained docker image of your application. This image will not only contain our code, but also all the dependencies that are neccessary to run the code. This image can then be used for both, easy deployment in production and as basis for ongoing development.

The image is not a static, though. In fact, it will see many revisions over time - which is supported nicely through dockers inheritance approach. We basically