Skip to content

Instantly share code, notes, and snippets.

View caseyWebb's full-sized avatar

Casey Webb caseyWebb

View GitHub Profile
@caseyWebb
caseyWebb / chip_update.sh
Last active July 27, 2020 16:31
C.H.I.P. Rescue Script
#!/bin/bash
# This assumes a freshly flashed CHIP. See https://github.com/caseyWebb/Flash-CHIP if you haven't done that.
# setup networking
sudo nmtui
# disable wifi powersaving
sudo wget -O/etc/network/if-up.d/wlan_pwr http://fordsfords.github.io/wlan_pwr/wlan_pwr
sudo chmod +x /etc/network/if-up.d/wlan_pwr
@caseyWebb
caseyWebb / 0.create_vm.sh
Last active July 9, 2021 18:28
Headless Windows Setup (WSL + OpenSSH)
#!/bin/bash
# Run this on the VM host
DOWNLOAD_URL=<download url> # Go to https://developer.microsoft.com/en-us/windows/downloads/virtual-machines to get the latest download url
VMNAME=UniversitySite
CPUS=6
RAM=10240
# Download VM from Microsoft
@caseyWebb
caseyWebb / sqip.css
Created February 10, 2018 09:28
SQIP Client
.sqip-container {
position: relative;
}
.sqip-container .fq {
position: absolute;
top: 0;
z-index: 0;
}
.sqip {
position: relative;
@caseyWebb
caseyWebb / GhostStoragePreprocessorSqipTransform.ts
Created February 10, 2018 09:08
GhostStoragePreprocessorSqipTransform
module.exports = class GhostStoragePreprocessorSqipTransform implements IGhostStoragePreprocessorTransform {
public async save(image: Image, targetDir?: string) {
const res = sqip({ filename: image.path })
const sqipPath = image.path + '.sqip.svg'
const sqipImage = Object.assign({}, image, {
name: image.name + '.sqip.svg',
path: sqipPath,
mimetype: 'image/svg',
type: 'image/svg'
})
@caseyWebb
caseyWebb / IGhostStoragePreprocessorTransform.d.ts
Last active February 10, 2018 08:54
IGhostStoragePreprocessorTransform
interface IGhostStoragePreprocessorTransform<T = {}> {
new?(config: T): void
save(img: Image, targetDir?: string): Promise<[Image, string | undefined][]>
delete(img: Image, targetDir?: string): Promise<[Image, string | undefined][]>
}
@caseyWebb
caseyWebb / runtime.html
Last active February 7, 2018 03:40
KnockoutJS HMR - Medium - 4
<hello-world>
<span data-bind="if: ready">
<span data-bind="component: { name: '__HOT__hello-world', params: params }">
Hello, World!
</span>
</span>
</hello-world>
@caseyWebb
caseyWebb / index.js
Last active February 7, 2018 03:39
KnockoutJS HMR - Medium - 3
import * as ko from 'knockout'
import * as helloWorldComponent from './hello'
+ const hotHelloLoader = {
+ hotComponentName: '__HOT__hello-world',
+ ready: ko.observable(true),
+ loadComponent(name, componentConfig, cb) {
+ if (name !== 'hello-world') return cb(null)
+ ko.components.register(hotHelloLoader.hotComponentName, componentConfig)
+ if (!componentConfig.viewModel) {
@caseyWebb
caseyWebb / weppack.config.js
Created February 7, 2018 03:04
KnockoutJS HMR - Medium - 2
'use strict'
+ const { HotModuleReplacementPlugin, NamedModulesPlugin } = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
context: __dirname,
entry: './index.js',
output: './bundle.js',
+ devServer: {
@caseyWebb
caseyWebb / hello.js
Last active February 7, 2018 03:05
KnockoutJS HMR - Medium - 1
export const template = 'Hello, World!'
@caseyWebb
caseyWebb / app.js
Last active February 6, 2018 04:39
Webpack HMR Bug
import { log } from './logger.js'
log()
module.hot.accept('./logger.js', () => log())