Skip to content

Instantly share code, notes, and snippets.

View bronson's full-sized avatar

Scott Bronson bronson

  • Santa Cruz, CA
View GitHub Profile
@bronson
bronson / unstable-tailscale.nix
Last active October 2, 2022 01:47 — forked from epk/unstable-tailscale.nix
Installs unstable Tailscale
# Installs the latest version of Tailscale instead of the stable version.
# Run these two commands to prepare the unstable channel:
# nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
# nix-channel --update nixpkgs-unstable
{ config, lib, pkgs, ... }:
let
baseconfig = { allowUnfree = true; };
unstable = import <nixpkgs-unstable> { config = baseconfig; };
@bronson
bronson / cookie.js
Last active March 26, 2022 17:38
Read and write cookies from javascript. Small and simple.
@bronson
bronson / .vimrc
Created July 9, 2011 02:57
difference between Pathogen and Vundle?
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" enabling this fixes things:
"call pathogen#runtime_append_all_bundles()
filetype indent plugin on
@bronson
bronson / rake routes
Last active March 16, 2018 19:57
routes
Prefix Verb URI Pattern Controller#Action
project_items GET /projects/:project_id/items(.:format) items#index
POST /projects/:project_id/items(.:format) items#create
new_project_item GET /projects/:project_id/items/new(.:format) items#new
edit_project_item GET /projects/:project_id/items/:id/edit(.:format) items#edit
project_item GET /projects/:project_id/items/:id(.:format) items#show
PATCH /projects/:project_id/items/:id(.:format) items#update
PUT /projects/:project_id/items/:id(.:format) items#update
DELETE /projects/:project_id/items/:id(.:format) items#destroy
projects GET /projects(.:format) projects#index
// A loader to transform a partial manifest.json file into a complete
// manifest.json file by adding entries from an NPM package.json.
// https://stackoverflow.com/questions/44232366/how-do-i-build-a-json-file-with-webpack
const fs = require('fs')
module.exports = function (source) {
this.addDependency('./package.json')
this.cacheable()
const pkg = JSON.parse(fs.readFileSync('./package.json'))
const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const isProduction = (process.argv.indexOf('process.env.NODE_ENV=production') >= 0)
module.exports = {
// tell webpack where to loacate manifest-loader.js
resolveLoader: {
// currently:
entry: {
content: './src/content.js',
'hot-reload': './src/hot-reload.js',
manifest: './src/manifest.json',
popup: './src/popup.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
@bronson
bronson / cpuprofile.txt
Created April 19, 2017 19:46
atom window reload
2713.3 ms 2713.3 ms (idle)
381.5 ms13.85 % 381.5 ms13.85 % (program)
248.6 ms9.02 % 475.1 ms17.24 % SourceMapConsumer_parseMappings<embedded>:103407
185.7 ms6.74 % 757.1 ms27.48 % get_Module._compile<embedded>:7340
154.4 ms5.60 % 154.4 ms5.60 % (garbage collector)
99.1 ms3.60 % 124.8 ms4.53 % compareByOriginalPositions<embedded>:177498
78.1 ms2.83 % 81.0 ms2.94 % attachedCallbackworkspace-element.js:13
69.9 ms2.54 % 71.0 ms2.58 % process.binding.internalModuleReadFileELECTRON_ASAR.js:585
69.6 ms2.53 % 69.6 ms2.53 % module.exports.AtomEnvironment.restoreWindowBackground<embedded>:994
57.6 ms2.09 % 67.9 ms2.46 % normalizeStringPosixpath.js:78
@bronson
bronson / 0 results
Last active March 24, 2017 02:06
benchmark splitting some strings in half (precompiling regexes)
$ rustc -L target/release/deps --test src/bench.rs && ./bench --bench
running 5 tests
test tests::bench_using_indexing ... bench: 1,674 ns/iter (+/- 69)
test tests::bench_using_regex_index ... bench: 249 ns/iter (+/- 20)
test tests::bench_using_regex_next ... bench: 134 ns/iter (+/- 7)
test tests::bench_using_regex_vec ... bench: 532 ns/iter (+/- 66)
test tests::bench_using_window ... bench: 964 ns/iter (+/- 39)
test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured
@bronson
bronson / annotations.md
Last active November 23, 2016 01:10
Centos 7 default iptables config

So, why does libvirt set its rules up like this?

Since the default policy is ACCEPT, and all rules are ACCEPT, that means that all traffic coming into the host is accepted. So why bother allowing DNS and BOOTP (DHCP) traffic? Answer: because libvirt wants to ensure that, even if the INPUT chain has a different policy, all guests (traffic originating on the virbr0 interface) will receive DNS and DHCP service from the host.

Chain INPUT (policy ACCEPT 380 packets, 37990 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     udp  --  virbr0 any     anywhere             anywhere             udp dpt:domain
    0     0 ACCEPT     tcp  --  virbr0 any     anywhere             anywhere             tcp dpt:domain
 0 0 ACCEPT udp -- virbr0 any anywhere anywhere udp dpt:bootps