Skip to content

Instantly share code, notes, and snippets.

@cha55son
cha55son / dynmotd
Last active June 9, 2023 21:06
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# Installation:
#
# 1. vim /etc/ssh/sshd_config
# PrintMotd no
#
# 2. vim /etc/pam.d/login
# # session optional pam_motd.so
#
@cha55son
cha55son / array_extend.php
Created September 4, 2013 19:09
Simple PHP function to emulate the jQuery extend feature.
function array_extend() {
$arrays = func_get_args();
$base = array_shift($arrays);
foreach ($arrays as $array) {
reset($base);
while (list($key, $value) = @each($array))
if (is_array($value) && @is_array($base[$key]))
$base[$key] = array_extend($base[$key], $value);
else $base[$key] = $value;
}
@cha55son
cha55son / ngrx-boilerplate-template.ts
Last active May 31, 2018 21:56
NgRx Boilerplate for a resource action and it's side effects
/**
* TYPES =======================================================
*/
export interface MyResourcesState extends EntityState<MyResource> {
getAllLoading: boolean;
getAllLoaded: boolean;
getAllLoadedError: Error | null;
}
/**
@cha55son
cha55son / table-extend.lua
Created May 12, 2013 02:23
Simple function that will recursively extend lua tables.
function extend(table1, table2)
for k,v in pairs(table2) do
if (type(table1[k]) == 'table' and type(v) == 'table') then
extend(table1[k], v)
else
table1[k] = v
end
end
end
@cha55son
cha55son / config_application.rb
Last active July 19, 2017 05:10
Disable Rails 5 Connection Pool
# config/application.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
@cha55son
cha55son / steam-game-status.coffee
Created March 22, 2016 18:56
Hubot: Post to a channel when a steam account starts/ends a game.
# Description:
# Post to a channel when a steam account starts a game.
#
# Commands:
#
# Configuration:
# STEAM_API_KEY: Steam community api key to access steam accounts.
# STEAM_USER_ID: The steam user id in which to monitor.
# STEAM_POST_CHANNEL_NAME: The channel to post to when the user starts playing.
#
@cha55son
cha55son / rss-poll.coffee
Last active August 29, 2015 13:59
Simple RSS/ATOM poller for Hubot
# Description:
# Polls the rss feeds and posts new content to the user or group chat.
#
# Dependencies:
# "feed-read": "0.0.1"
#
# Configuration:
# None
#
# Commands:
@cha55son
cha55son / entrance-notify.js
Created March 19, 2014 20:10
Durandal Transition Complete
/**
* The entrance transition module.
* @module entrance
* @requires system
* @requires composition
* @requires jquery
*/
define(['durandal/system', 'durandal/composition', 'jquery'], function(system, composition, $) {
var fadeOutDuration = 100;
var endValues = {