Skip to content

Instantly share code, notes, and snippets.

function FindProxyForURL(url, host) {
// If we are not on the office network or VPN, then use a proxy
if (!isInNet(myIpAddress(), "192.168.48.0", "255.255.240.0")) {
if (shExpMatch(host, "*staging.bmll.io") ||
(!shExpMatch(host, "innovation.dev.bmll.io") && shExpMatch(host, "*dev.bmll.io")) ||
shExpMatch(host, "*lab.bmlldev.com") ||
shExpMatch(host, "*staticweb.bmlldev.com") ||
shExpMatch(host, "*staging.bmlldev.com") ||
shExpMatch(host, "*dev.bmlldev.com") ||
shExpMatch(host, "*james.bmll.io") ||
@nite
nite / kali.md
Last active January 27, 2022 19:00

How to Spin up a VM on OSX via Command line

All you need to do is run the commands here in OSX terminal - the links are for reference.

Install these with the following few commands:

  • Homebrew, a command-line tool for installing apps on OSX
  • virtualbox, a free VM runner on OSX
  • vagrant, a command line VM runner for virtualbox

This will allow you to spin up a VM with a single command - you wont need to install virtualbox & vagrant again if you need another VM.

@nite
nite / pivot.ts
Last active July 20, 2021 22:14
typescript pivot
function pivot(meltedData, pivotCols: string[], varName: string, valueName: string) {
const groups = {};
for (const d of meltedData) {
const key = pivotCols.map((k) => d[k]).join('|');
const group = groups[key];
groups[key] = {
...(group ? group : fromPairs(pivotCols.map((k) => [k, d[k]]))),
[d[varName]]: d[valueName],
};
@nite
nite / toObservable.ts
Created March 4, 2021 11:51
wrap function in mobx computed() and convert to rxjs observable
import { Observable } from 'rxjs';
import { computed, IValueDidChange } from 'mobx';
import isNil from 'lodash/isNil';
import omit from 'lodash/omit';
import { IEqualsComparer } from 'mobx/lib/internal';
interface ToObservableOptions<T> {
initial?: boolean;
equals?: IEqualsComparer<T>;
}
@nite
nite / AgGridWrapper.tsx
Created March 5, 2020 21:06
ag-grid wrapper with persistence of grid column & filter state in localStorage
import {ColDef, ColGroupDef, ColumnApi, GridApi} from 'ag-grid-community';
import {AgGridReact} from 'ag-grid-react';
import {AgGridReactProps} from 'ag-grid-react/lib/agGridReact';
import {functions, isEqual, omit} from 'lodash';
import log from 'loglevel';
import React, {useState} from 'react';
import useDeepCompareEffect from 'use-deep-compare-effect'
const gridStateChangeEvents = ['model', 'displayedColumnsChanged'];
@nite
nite / index.html
Created October 21, 2019 22:04
Interactive Particle Logo
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ParticleSlider</title>
</head>
<body id="particle-slider">
<div class="slides">
<div id="first-slide" class="slide"
style="width: 100%; height 100%"
data-noise="100"
@nite
nite / js.ipynb
Last active April 1, 2019 21:40
Jupyter Notebook with client-side javascript interactive data visualisation in d3 & Plotly plots, plus a http fetch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nite
nite / plotly_crossfilter.py
Last active January 31, 2024 15:13
Plotly Dash Crossfilter
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
from dash.dependencies import Output, Input, State
import dash_table_experiments as dt
from plotly.graph_objs.layout import Margin
app = dash.Dash(static_folder='static')
@nite
nite / grid-selection.directive.ts
Last active August 15, 2018 16:47
Typescript ag-Grid Range selection directive which selects & highlights rows for any selected cell & emits a 'rangeSelectionRowsChanged' with a rows property of selected rows.
import {Directive, EventEmitter, Output} from '@angular/core';
import {AgGridNg2} from 'ag-grid-angular';
import {GridApi} from 'ag-grid';
/***
* Range selection directive which selects & highlights rows for any selected cell
* (ctrl+click for multiple ranges) and emits a 'rangeSelectionRowsChanged' with a
* rows property of selected rows.
*
* NOTE: this only currently supports client-side grids.
@nite
nite / kvp.js
Last active January 5, 2018 09:17
Serialise input as key-value pair string, eg. for human-readable logs.
/**
* Serialise input as key-value pair string, eg. for human-readable logs.
*
* @param {any} body
* @param {number} nest
* @param {string} delimiter
* @param {string} arrayDelimiter
* @param {boolean} nested
* @returns {string}
*/