Skip to content

Instantly share code, notes, and snippets.

View freshlogic's full-sized avatar

Shawn Miller freshlogic

View GitHub Profile
@freshlogic
freshlogic / app.js
Last active March 5, 2024 17:11
HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
var express = require('express');
var app = express();
app.enable('trust proxy');
// HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
app.use(function(req, res, next) {
if(req.headers['x-arr-ssl'] && !req.headers['x-forwarded-proto']) {
req.headers['x-forwarded-proto'] = 'https';
}
@freshlogic
freshlogic / init.sh
Last active September 26, 2023 02:40
This is for Mac computers with Apple silicon: https://support.apple.com/en-us/HT211814
#!/bin/zsh
set -e
# Enable right clicking
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode TwoButton
defaults write com.apple.driver.AppleHIDMouse Button2 -int 2
# You may need to reset the UI server or log out and back in for the changes to take effect
killall "SystemUIServer"
#!/bin/bash
# Install updates
sudo apt update -y
sudo apt -qq upgrade -y
sudo apt -qq autoremove -y > /dev/null
# Install Chromium
sudo apt install -y chromium-browser unclutter
@freshlogic
freshlogic / init.sh
Last active June 15, 2021 16:55
This is for Mac computers with Intel processors
# This is for Mac computers with Intel processors
# For Mac computers with Apple silicon (https://support.apple.com/en-us/HT211814) see https://gist.github.com/freshlogic/fa3dcc44eedd36b4602d541ccd5b4368
# Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
# MongoDB
brew tap mongodb/brew
brew install mongodb-community@4.0
[
{
"id": "logical-trustworthy-glass",
"username": "shawn",
"offer": "2-pack-restorology-genius-pillow-cooling-gel-fiber-pillow-with-sateen-gusset-1",
"total": 29.00
},
{
"id": "distinguished-amusing-honeydew",
"username": "dave",
@freshlogic
freshlogic / app.js
Last active July 8, 2019 18:53
Check an area code for available Google Voice numbers and post the results to Campfire
var Campfire = require('campfire').Campfire;
var request = require('request');
var areaCode = 972;
var campfire = new Campfire({ ssl: true, token: 'YOUR CAMPFIRE API TOKEN HERE', account: 'YOUR CAMPFIRE SUBDOMAIN NAME HERE' });
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' };
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US';
request.get({ url: url, headers: headers }, function(error, response, body) {
var json = JSON.parse(body);
@freshlogic
freshlogic / gist:cc7326042e80f29840b4
Last active October 13, 2017 19:24
Web.cloud.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
</appSettings>
<system.web>
<customErrors mode="off" />
<httpRuntime maxQueryStringLength="2097151" maxUrlLength="2097151" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
@freshlogic
freshlogic / gist:48f86ac9a332cb9d2390b131077b4a7e
Last active September 2, 2017 16:41
Coders Bracket 2016
function(game, team1, team2) {
var percentages = {
round5: { 1: 100, 2: 94, 3: 85, 4: 78, 5: 68, 6: 66, 7: 60, 8: 48, 9: 52, 10: 40, 11: 34, 12: 35, 13: 22, 14: 15, 15: 6, 16: 0 },
round4: { 1: 87, 2: 69, 3: 61, 4: 56, 5: 52, 6: 51, 7: 27, 8: 18, 9: 8, 10: 46, 11: 38, 12: 49, 13: 24, 14: 12, 15: 14, 16: 0 },
round3: { 1: 79, 2: 72, 3: 50, 4: 35, 5: 21, 6: 33, 7: 37, 8: 70, 9: 40, 10: 33, 11: 33, 12: 5, 13: 0, 14: 0, 15: 0, 16: 0 },
round2: { 1: 59, 2: 46, 3: 47, 4: 72, 5: 75, 6: 23, 7: 0, 8: 57, 9: 50, 10: 0, 11: 60, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 },
round1: { 1: 57, 2: 48, 3: 64, 4: 23, 5: 50, 6: 67, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 },
round0: { 1: 67, 2: 33, 3: 44, 4: 33, 5: 0, 6: 50, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 }
};
{
"deal": {
"features": "- Model: S003AP, ACB0BU\r\n- Steer the little ball with your phone, it's fun, really\r\n- Compatible with iOS or Android, despite Apple-centric packaging\r\n- Includes Nubby Cover for all-terrain spherical action\r\n- Augmented-reality game apps might be more fun than rolling Sphero around your non-augmented reality, but we're not promising anything on that point",
"id": "a6ki0000000TON3AAO",
"items": [
{
"attributes": [
],
"condition": "Refurbished",
@freshlogic
freshlogic / mailchimp.js
Last active May 24, 2016 04:31
Error 212
const mcapi = require('mailchimp-api');
const mailchimp = new mcapi.Mailchimp(process.env.mailchimpApiKey);
const mailchimpListId = process.env.mailchimpListId;
var subscribe = {
double_optin: false,
email: { email: 'test@mediocre.com' },
id: mailchimpListId
};