Skip to content

Instantly share code, notes, and snippets.

Avatar
🙏
Trying my best to be worth something.

Benjamin Lupton balupton

🙏
Trying my best to be worth something.
View GitHub Profile
@balupton
balupton / cors.js
Created Sep 11, 2012
Acheiving CORS via a Node HTTP Server
View cors.js
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);
@balupton
balupton / readme.md
Last active Jul 24, 2021
Blog: Libertarian Constitution
View readme.md
@balupton
balupton / README.md
Last active Jul 17, 2021
Installing ChromiumOS
View README.md

Install ChromiumOS

  1. Get Chromium OS from one of the following places
    1. Download the vanilla build (old but stable): http://chromeos.hexxeh.net/
      1. NOTE: Password is facepunch
    2. Download the nightly build (sync doesn't work): http://download-chromiumos.appspot.com/
      1. NOTE: If you want developer mode, you must change _base_ in the download URL to _test_ as the base image does not have developer tools enabled
      2. NOTE: Password is unknown, instructions for working around this are provided later
      3. NOTE: I could not get syncing working with this build, perhaps due to no API KEYS being provided???
      4. NOTE: I could not move past the welcome screen on the 64bit build due to no network being found (32bit worked)
@balupton
balupton / README.md
Last active Jul 4, 2021
DNSCrypt Setup
View README.md
@balupton
balupton / README.md
Last active Jun 20, 2021
Instances of popular open-sourcers duplicating packages and blocking people
View README.md

It seems some open-sourcers strategies may have been to gain fame from finding existing packages then duplicating them (with the exact same functionality, or a subset or superset) instead of sending PRs or using existing solutions. Package maintainers can want to do this to build up a portfolio of popular packages, to consolidate popularity and power to themselves, and thus gain funding. Willfull ignorance of alternatives at the time of publishing stems from the similar intention. Naivity however may be accidental, in which case consolidation of duplicates can be a desired outcome where possible, as it consolidates maintainership and features for a better user experience. There is valid reason for duplication however, where an original author was not receptive to pull requests.

This gist is to look into such instances. It is not to say whether or a case was accidental or not. Only that such duplication exists, in the hope that it can be noted and hopefully resolved.

Eventually one could do up a programmatic

@balupton
balupton / README.md
Created Jul 3, 2013
Android Emulator
View README.md

Android Emulator

  1. Download Android Studio
  2. Create a virtual device: /Applications/Android\ Studio.app/sdk/tools/android create avd -n <name> -t 1
  3. List your virtual devices: /Applications/Android\ Studio.app/sdk/tools/android list avd
  4. Run your virtual device: /Applications/Android\ Studio.app/sdk/tools/emulator -avd basic
@balupton
balupton / next.config.js
Created Feb 3, 2017
next.js webpack configs
View next.config.js
module.exports = {
webpack: (config) => {
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
config.plugins = config.plugins || []
config.plugins.push(new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/))
config.plugins.push(new BundleAnalyzerPlugin())
return config
}
}
@balupton
balupton / README.md
Last active May 23, 2021
MacOS / Linux Filesystem Adventures
View README.md

MacOS / Linux Filesystem Adventures

Goal is to have a data store between MacOS and Linux (Ubuntu Server on a Raspberry Pi 4), with the main use case being for Plex Media Server.

The hard drive:

  • A single 12TB USB HDD.

The systems:

@balupton
balupton / README.md
Last active May 15, 2021
Convert XPS to PDF on Linux and Mac using bash
View README.md

Convert XPS to PDF on Linux and Mac

  1. Download this file

  2. chmod +x ./xps2pdf.bash

  3. To convert a particular xps file: ./xps2pdf.bash thefile.xps

  4. To convert all xps files in the current working directory: ./xps2pdf.bash *.xps