Skip to content

Instantly share code, notes, and snippets.

View cpuspellcaster's full-sized avatar

cpuspellcaster cpuspellcaster

View GitHub Profile
@cpuspellcaster
cpuspellcaster / main.go
Created February 11, 2023 00:28 — forked from rifelpet/main.go
hcl2 - hclwrite printing maps over multiple lines
package main
import (
"fmt"
"sort"
"github.com/hashicorp/hcl/v2/hclsyntax"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/zclconf/go-cty/cty"
@cpuspellcaster
cpuspellcaster / create-iso.sh
Created May 7, 2017 23:46 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@cpuspellcaster
cpuspellcaster / create-iso.sh
Created May 7, 2017 23:46 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@cpuspellcaster
cpuspellcaster / rabbitmq.txt
Last active February 18, 2017 22:29 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
rabbitmqctl set_policy ha-all "" '{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic"}'
@cpuspellcaster
cpuspellcaster / SSHwithgit2go.go
Created November 9, 2016 22:33 — forked from zchee/SSHwithgit2go.go
Working example with SSH and libgit2/git2go
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "")
return git.ErrorCode(ret), &cred
@cpuspellcaster
cpuspellcaster / HowToOTGFast.md
Created May 21, 2016 03:22 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. Finally, open up the cmdline.txt. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single

@cpuspellcaster
cpuspellcaster / build-openjdk9-osx.sh
Last active September 19, 2015 03:19 — forked from bonifaido/build-openjdk9-osx.sh
Build OpenJDK 9 Zero(Shark) on Mac OS X Yosemite (bash build-openjdk9-osx.sh)
#!/bin/bash
# Latest Mercurial, OS X Command Line Tools, JDK 8 and libffi are needed
# Tested with OSX 10.10.3 and Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
brew install mercurial
brew install libffi
brew link libffi --force
# only needed if you build the zeroshark variant
# brew install llvm
# brew link llvm --force
hg clone http://hg.openjdk.java.net/jdk9/jdk9
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.31090480089187622</real>
<key>Green Component</key>
<real>0.31097450852394104</real>

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying