Skip to content

Instantly share code, notes, and snippets.

View shreve's full-sized avatar

Violet Shreve shreve

View GitHub Profile
@shreve
shreve / config.fish
Last active June 5, 2019 01:40
Fish builtin cd patch
function cd
set paths $CDPATH ./
for location in $paths
if test -d $location$argv
builtin cd $location$argv
return
end
end
builtin cd $argv
end
@shreve
shreve / Reticle.cs
Last active April 21, 2022 18:05
2D Rope Swinging in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Reticle : MonoBehaviour {
public GameObject prefab;
GameObject sprite;
LineRenderer line;
@shreve
shreve / sharks
Last active October 3, 2018 19:52
#!/usr/bin/env bash
# Requirements:
# scrot (for screenshots)
# byzanz-record (for gif recordings)
pic_format="/home/jacob/Pictures/screenshots/%Y-%m-%d--%H-%M-%S--\$wx\$h.png"
gif_duration=10
gif_format=$(date +"/home/jacob/Pictures/screenshots/%Y-%m-%d--%H-%M-%S--${gif_duration}s.gif")
client_id=c9a6efb3d7932fd
@shreve
shreve / CallbackList.cs
Last active September 21, 2018 13:32
Callback List
using System;
using System.Collections.Generic;
using ActionList = System.Collections.Generic.List<System.Action>;
using ActionDict = System.Collections.Generic
.Dictionary<string, System.Collections.Generic.List<System.Action>>;
// A list of callbacks to easily implement the observable pattern
// Attach to any class as a public static for an easy interface
//
#!/usr/bin/env bash
log_ssh_connection() {
[ -z "$SSH_CONNECTION" ] && echo "It appears you're not connected via SSH" && exit 0;
# SSH_CONNECTION="45.77.136.12 44298 10.240.0.6 22"
store=/var/log/ssh-logins.log
[ ! -e $store ] && sudo touch $store && sudo chmod a+w $store
if ! which jq >/dev/null; then
@shreve
shreve / utorrent.sh
Last active June 12, 2018 00:43
uTorrent add script
#!/usr/bin/env bash
# This script uses HTTPie, but could easily be adapted to use cURL.
# Change the host to be the location of your uTorrent server.
# Start this script and you'll get a prompt to paste in magnet links or links to torrent files
host=http://192.168.0.111:8080
rpc=$host/gui/
token=""
@shreve
shreve / response_handler.rb
Created March 5, 2018 16:52
Respondable DSL Ideas
#
# Response Handler DSL Demo
#
# The goal of this update is twofold:
# 1. Make the code read more clearly about what it's doing
# 2. Remove the need for the understands? method to be written
#
#
# More Readable Code
#
@shreve
shreve / monty.rb
Last active December 23, 2017 02:17
The Monty Hall Problem
# Simulation of the Monty Hall problem
#
# In a given game, there are three doors with a prize behind one.
# The player picks one of the doors.
# Monty removes one of the non-selected doors that isn't the prize door.
# There are now two doors left in play, and one contains a prize.
# Monty asks the player if they'd like to switch doors.
#
# What should the player do? What is the probability the player will win if
# they switch doors vs staying the same?
@shreve
shreve / example_job.rb
Created November 27, 2017 15:41
Recurring job scheduling with ActiveJob
class ExampleJob < Job
schedule every: 30.minutes,
wait_until: Time.now.tomorrow.midnight
end

Testing Wellopp Messenger

Managing Content

This set of actions requires a messenger_admin role.

  1. Click the "Messages" link at the bottom of the left bar
  2. See that your client name is displayed in the page header
  3. Click the "Add New Message" button