Skip to content

Instantly share code, notes, and snippets.

@xnzac
xnzac / nvm-v0.39.3-install.sh
Created April 20, 2023 05:48
nvm-sh/nvm/v0.39.3/install.sh on Apr 20th 2023
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
}
nvm_echo() {
command printf %s\\n "$*" 2>/dev/null
@xnzac
xnzac / get-ghcup.sh
Created March 29, 2023 10:52
get-ghcup.haskell.org on Mar 29th 2023
#!/bin/sh
# This script downloads the 'ghcup' binary into '~/.ghcup/bin/' and then runs an interactive
# installation that lets you choose various options. Below is a list of environment variables
# that affect the installation procedure.
# Main settings:
# * BOOTSTRAP_HASKELL_NONINTERACTIVE - any nonzero value for noninteractive installation
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
# * BOOTSTRAP_HASKELL_MINIMAL - any nonzero value to only install ghcup
#!/bin/sh
set -ue
# (c) Copyright Fabrice Le Fessant INRIA/OCamlPro 2013
# (c) Copyright Louis Gesbert OCamlPro 2014-2017
VERSION='2.1.4'
DEV_VERSION='2.1.4'
DEFAULT_BINDIR=/usr/local/bin
@xnzac
xnzac / sh.rustup.rs.sh
Created March 29, 2023 08:23
sh.rustup.rs on Mar 29th 2023
#!/bin/sh
# shellcheck shell=dash
# This is just a little script that can be downloaded from the internet to
# install rustup. It just does platform detection, downloads the installer
# and runs it.
# It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local`
# extension. Note: Most shells limit `local` to 1 var per line, contra bash.
@xnzac
xnzac / nodesource-setup_lts.sh
Last active March 29, 2023 08:35
deb.nodesource setup_lts for Node.js 18.x
#!/bin/bash
# Discussion, issues and change requests at:
# https://github.com/nodesource/distributions
#
# Script to install the NodeSource Node.js 18.x repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#
@xnzac
xnzac / How-to-create-bootable-USB-stick-on-OSX
Created April 11, 2022 08:01
Howto: create bootable USB stick on Mac OS X
How-To: create bootable USB-stick from ISO image:
=================================================
1. Download ISO image file:
wget -o ~/Desktop/mini.iso http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/mini.iso
2. Convert ISO file to DMG format using hdiutil:
hdiutil convert -format UDRW -o Desktop/mini.img Desktop/mini.iso
@xnzac
xnzac / be_hash_matching.rb
Created July 22, 2014 17:58
RSpec2 custom matcher for DiffMatcher gem
require 'diff_matcher'
RSpec::Matchers.define :be_hash_matching do |expected|
match do |actual|
opts = {:color_enabled=>RSpec::configuration.color_enabled?}
@difference = DiffMatcher::Difference.new(expected, actual, opts)
@difference.matching?
end
failure_message_for_should do |actual|
@xnzac
xnzac / gist:b6d8eddfe60042168d36
Created June 30, 2014 07:36
bundle_install_taobao.sh
# Simple script to replace first line of Gemfile with taobao's rubygem mirror url
# save as ~/bin/bundle_install_taobao.sh
# create alias in ~/.zsh_alias: alias bi='bash ~/bin/bundle_install_taobao.sh'
# run 'bi' from project folder
echo "Copying Gemfile to Gemfile_taobao using ruby.taobao.org"
echo
taobao="'source http\:\/\/ruby.taobao.org'"
sed "1s/.*/$taobao/" Gemfile > Gemfile_taobao
@xnzac
xnzac / leaflet-0-8-dev.js
Created April 21, 2014 08:16
leaflet-0-8-dev.js
/*
Leaflet 0.8-dev (c5091ee), a JS library for interactive maps. http://leafletjs.com
(c) 2010-2014 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
(function (window, document, undefined) {
var L = {
version: '0.8-dev'
};
function expose() {
@xnzac
xnzac / gist:11131425
Created April 21, 2014 03:24
Contagious: Why Things Catch On
Contagious: Why Things Catch On
By Jonah Berger
Simon & Schuster Readers Group Guide
What makes products and ideas catch on and become popular? Why do some stories get shared more than others? Why are some rumors infectious? What makes things “go viral”?
In Contagious, Jonah Berger shares the secret science behind social transmission. Why we talk about and share some things rather than others. Why we pass things on. Filled with engaging stories and comprehensive research Contagious is an essential tool for anyone that wants to make their product or idea spread.
QUESTIONS FOR DISCUSSION
1) Consider and discuss the most recent email forward you received. It might have been a news article, video, or story. What aspects of the STEPPS framework did it adhere to? Do the same analysis for the last viral video you watched, hot restaurant you tried, hit movie you saw, etc. Which concepts in the framework apply?
2) Which examples that Berger mentioned (e.g., Blendtec, Dove’s Evolution, white iPhone earbuds) had you bee