Skip to content

Instantly share code, notes, and snippets.

View nicerobot's full-sized avatar
🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎

nicerobot nicerobot

🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
@nicerobot
nicerobot / Makefile
Last active December 11, 2023 02:09
Alias a []float64 slice as a []byte slice
.PHONY: test
test:
go test -v
@nicerobot
nicerobot / Story.scala
Created December 2, 2012 16:19
Simple Scala "DSL" example using easy to understand constructs.
object Story {
object Once { def upon = (x: a.type) => x }
object a { def time = (x: languages.type) => x }
object languages { def were = (x: inflexible.type) => x }
object inflexible { def along = (x: came.type) => x }
object came { def Scala = (x: inflexible.type) => x }
implicit def string(s : String) : inflexible.type = inflexible
def main(args: Array[String]): Unit = {
Once upon a time languages were inflexible; "Then " along came Scala ". The End!"
@nicerobot
nicerobot / .screenrc
Created December 7, 2011 12:59
.screenrc with "tabs" using hardstatus and caption options
# look and feel
caption always "%{= bb}%{+b w}%h %=%{=b rw} %l %{= db} ${USER}@%H %{= dg}%c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
# skip the startup message
startup_message off
# go to home dir
chdir
@nicerobot
nicerobot / co.reasoning.scala
Last active August 7, 2022 16:35
Scala generics, "simplified", covariance and contravariance.
// This is an example of how to reason about covariance vs contravariance.
// Between the two co*.reasoning.scala examples, the following compiles but meaning is slightly different due to the class hierarchy.
type SHORT = A[SMALL]
type INT = A[MEDIUM]
type LONG = A[LARGE]
val s:SHORT = new SHORT()
val i:INT = s
@nicerobot
nicerobot / chrome-cookies.sh
Created December 7, 2011 16:59
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'
@nicerobot
nicerobot / delete-activity.js
Last active June 6, 2022 16:39
JavaScript to Delete all (most) Facebook Activity as of 20201103
// 1. Navigate to your Activity Log
// 2. Paste this into the JavaScript Console
function clickDelete() {
document.querySelectorAll('[aria-label="Move to Trash"]')[0].click()
}
function clickMenu() {
document.querySelectorAll('[role="menuitem"]')[2].click();
setTimeout(clickDelete, 250);
}
@nicerobot
nicerobot / README.md
Last active May 22, 2022 12:57
PostgreSQL Kubernetes Service

Create the Kubernetes service

curl -s https://gist.githubusercontent.com/nicerobot/fef144c9328b487e85f7a6ccbd5f70bc/raw/kubectl | bash -s -- apply

Run psql

@nicerobot
nicerobot / backup.sh
Last active April 15, 2022 23:13 — forked from joneskoo/gist-backup.py
Clone or update a user's gists locally
#!/bin/bash
curl -ks https://gist.githubusercontent.com/nicerobot/1622504/raw/gist-backup.py | USER=${USER} python3
@nicerobot
nicerobot / jstatd.sh
Created November 18, 2011 00:01
Run jstatd w/o error 'access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)'
#!/bin/sh
policy=${HOME}/.jstatd.all.policy
[ -r ${policy} ] || cat >${policy} <<'POLICY'
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
POLICY
jstatd -J-Djava.security.policy=${policy} &
@nicerobot
nicerobot / jenkins.sh
Created October 14, 2012 21:18
Create Jenkins group/user on Mac OS X
#!/bin/sh
# curl -Lks https://raw.github.com/gist/3889839/jenkins.sh | sudo sh -s
# from http://mattonrails.wordpress.com/2011/06/08/jenkins-homebrew-mac-daemo/
# open http://localhost:8080
brew list jenkins || brew install jenkins
mkdir /var/jenkins
/usr/sbin/dseditgroup -o create -r 'Jenkins CI Group' -i 600 _jenkins
dscl . -append /Groups/_jenkins passwd "*"
dscl . -create /Users/_jenkins
dscl . -append /Users/_jenkins RecordName jenkins