Skip to content

Instantly share code, notes, and snippets.

@rhysyngsun
rhysyngsun / register.py
Created May 25, 2021 18:32
Pants django-run goal
"""Plugin for django management commands"""
import glob
from pathlib import PurePath
from os.path import join, relpath, exists
from shutil import copyfile
from pants.base.build_root import BuildRoot
from pants.core.goals.run import RunFieldSet, RunRequest, RunSubsystem
from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest
from pants.engine.console import Console
@rhysyngsun
rhysyngsun / laptop-setup.md
Last active March 2, 2020 21:14
Setup steps for a new laptop

These are instructions that are known to work with a Dell Latitude 7400 running Windows 10. This assumes you have completed windows setup.

Dual Boot Windows/Ubuntu

Disable Secure Boot

  • Restart, tapping F2 until you get into BIOS
  • Go into the Secure Boot menu option and disable it
  • Save and Exit
@rhysyngsun
rhysyngsun / odl-hosts.sh
Created March 7, 2018 19:05
odl-hosts.sh
#!/usr/bin/env bash
#
# Usage:
# ./odl-hosts.sh [ROOT_DOMAIN]
#
# Dependencies:
# - hostess: https://github.com/cbednarski/hostess
# - jq: https://stedolan.github.io/jq/

Keybase proof

I hereby claim:

  • I am rhysyngsun on github.
  • I am rhysyngsun (https://keybase.io/rhysyngsun) on keybase.
  • I have a public key whose fingerprint is C458 C9BE 12C9 B8E4 6B5E 16C3 59B6 FB17 FFCA A7C6

To claim this, I am signing this object:

@rhysyngsun
rhysyngsun / BuildConfig.groovy
Created February 18, 2014 20:05
Using a specific version of LessCSS with lesscss-resources
grails.project.dependency.resolution = {
dependencies {
runtime ('org.lesscss:lesscss:1.3.3')
}
plugins {
compile(":lesscss-resources:1.3.1") {
excludes "lesscss"
}
}
}
#!/bin/bash
# Bash script to stub out an ansible role
read -p "Role name: " rolename
mkdir -p roles/$rolename/meta
mkdir -p roles/$rolename/files
mkdir -p roles/$rolename/tasks
mkdir -p roles/$rolename/templates
mkdir -p roles/$rolename/vars
@rhysyngsun
rhysyngsun / gist:5238963
Last active December 15, 2015 09:29
Only tested for OSX. Run grails with https and bind to your machine's current ip. Be sure to substitute "en1" with the correct network interface.
# Only tested for OSX
# Substitute 'en1' with the correct network interface
alias ip='ifconfig en1 | grep inet | grep -v inet6 | cut -d " " -f 2'
# run this alias
alias grasip='grails run-app -https -Dserver.host=$(ip)'
// Example #1
def splitMe = 'First sentence. Second.'
def cl = { split('.') }
cl.resolveStrategy = Closure.DELEGATE_FIRST
cl.delegate = splitMe
def sentences = cl()
authorization {
module1 { // as many modules as you want
controllers = ['controller1']
exludes = ['index'] // optional
roles = [Roles.PREMIUM_MEMBER]
}
}
Source:
def builder = new GroovyCssBuilder();
def str = builder."#header" {
"bg-color" 0x000000
"border-color" 0x4820bf
h1 {
".sub" {
"text-decoration" "underline"