Skip to content

Instantly share code, notes, and snippets.

View mwpastore's full-sized avatar

Mike Pastore mwpastore

  • Chicago, Illinois
View GitHub Profile
@mwpastore
mwpastore / ExampleLoader.sql
Last active December 3, 2024 22:38
Update n2-reporting ETL process
DECLARE @fiscalYearQuarterName NVARCHAR(10) = N'2022Q4';
DECLARE @fromBusinessDay DATE;
DECLARE @toBusinessDay DATE;
--
-- prepare switch_staging fact tables for bulk loading
-- N.B. this truncates whole tables so we don't waste time rebuilding indexes, etc. over junk data later
--
EXEC [etl].[DematerializeAggs]
@mwpastore
mwpastore / README.md
Last active October 15, 2023 01:01
pfSense unbound+dnsmasq

What is this?

This guide shows how to replace the DHCP Server function in pfSense with dnsmasq. You can do this for some or all of your subnets. This addresses a 12+-years old [bug][1] in pfSense.

While it is possible to replace the DHCPv6 Server & RA and/or DNS Resolver functions in pfSense with dnsmasq as well, these are out of scope for this guide. Unbound can run in recursive mode and it has some performance advantages over dnsmasq; generally speaking pfSense seems "happier" with it enabled.

DISCLAIMER: While I have done profesionally network administration in the past, I am not per se a professional network administrator. I'm just a guy with an overly-complicated homelab who's been using dnsmasq for many years. Follow this guide at your own risk—and please take a backup before you start!

Pros

@mwpastore
mwpastore / -with-state.js
Last active April 5, 2023 17:29
Ember/Glimmer computed getter with access to previous value
import { resource } from 'ember-resources';
const withState =
({ ...state }, fn) =>
resource(() => Object.assign(state, fn({ ...state })));
export default { withState };
@mwpastore
mwpastore / on-key.js
Created May 19, 2020 16:27
{{on-key}} modifier for Ember.js
import { modifier } from 'ember-modifier';
import { isArray } from '@ember/array';
import { capitalize } from '@ember/string';
import { isEmpty, isPresent, typeOf } from '@ember/utils';
const { isInteger } = Number;
const parseKeys = arr => arr
.filter(_ => typeOf(_) === 'string')
@mwpastore
mwpastore / controllers.application\.js
Created March 9, 2020 00:54
(action (mut foo)) vs (fn (mut foo))
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked
prop;
@tracked
propDidUpdate = false;
@mwpastore
mwpastore / shares.conf
Last active January 9, 2020 16:21
Example of Samba ACL changes from 4.10 to 4.11
[tank_active]
browsable = yes
read only = no
guest ok = no
valid users = @users
path = /tank/active
block size = 4096
write cache size = 131072
@mwpastore
mwpastore / cmdline.sh
Last active December 20, 2019 03:35
VCL snippets
mkfs.ext4 -b 4k -C 128k -E num_backup_sb=0,packed_meta_blocks=1,root_owner=111:118 -O bigalloc,extent,flex_bg,^has_journal,mmp,sparse_super2 -L varnish-cache -N 64 -v /dev/sdc
@mwpastore
mwpastore / rg-refresh.sh
Last active June 4, 2018 05:52
Automated VLAN flop for AT&T RG workaround
#!/bin/bash
###
# PURPOSE
#
# Execute a VLAN "flop" to allow the AT&T Residential Gateway (RG) to perform
# 802.1x authentication via the Optical Network Terminal (ONT) before falling
# back to the subscriber's "own" router/gateway hardware. The RG is toggled off
# and on as needed via a remote-controlled power outlet (see below).
#
# For more information about this procedure, please see brianlan's original
@mwpastore
mwpastore / -computed-promise.js
Last active September 28, 2017 22:16
Promise-aware compute macros
import computed from 'ember-macro-helpers/computed';
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
import { typeOf } from '@ember/utils';
import { all } from 'rsvp';
export default function(Proxy) {
const PromiseProxy = Proxy.extend(PromiseProxyMixin);
@mwpastore
mwpastore / components.my-component.js
Last active September 19, 2017 23:22
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
greeting: 'Hello',
actions: {
showAlert(message) {
const greeting = this.get('greeting');
alert(`${greeting}, ${message}!`);