Skip to content

Instantly share code, notes, and snippets.

View mikew's full-sized avatar

mikew mikew

  • 709scene
  • St. John's, Newfoundland
View GitHub Profile
function drawLine(length = 0) {
  // We don't need to do anything in the loop itself. This is honestly a little
  // too "clever" but it works to build a string of #s.
  for(var line = ''; line.length < length; line += '#') {
  }

  // Bonus part:
  // This checks if the number of #s will be even or not.
 // It's called the "modulo operator". Think of it as "the remainder of
#NoEnv
; Recommended for performance and compatibility with future AutoHotkey releases.
; Needs to be the absolute first thing.
; Enable warnings to assist with detecting common errors.
; #Warn
; Recommended for new scripts due to its superior speed and reliability.
SendMode Input
@mikew
mikew / plug_disable.md
Created March 8, 2016 21:24
A way to disable a plugin in vim-plug

plug_disable.vim

If your vim distribution uses vim-plug and includes plugins you don't want, or if you want to simply maintain a single set of plugins but disable some on certain machines, this may be for you.

Source

let g:plugs_disabled = []
function! plug_disable#commit()
 for name in g:plugs_disabled
@mikew
mikew / 00-README.md
Last active October 9, 2015 03:50
replace-all-env-vars bash function

Usage

cat /file | replace-all-env-vars > /file
# Or:
replace-all-env-vars /file > /file
function replace-all-env-vars () {
@mikew
mikew / 00-README.md
Last active November 23, 2015 16:38
docker-machine create -d vmwarefusion
docker_machine_create_vmwarefusion () {
  name="${1:-test}"
  dir="${HOME}/.docker/machine/machines/${name}"
  vmx="${dir}/${name}.vmx"
  vmrun="/Applications/VMware Fusion.app/Contents/Library/vmrun"

  # Something about the initial run of docker-machine+vmwarefusion needs sudo
  sudo $(which docker-machine) -D create -d vmwarefusion "${name}"
 
components = {}
addOne = (name, component) ->
components[name] = component
return
addMany = (obj) ->
addOne name, component for own name, component of obj
@mikew
mikew / README.md
Last active January 2, 2016 18:59
Of ui-router and controllers

This is really just a shorthand for:

  • Creating an Angular controller using standard object notation.
  • Less repetition, but full support, of dependencies.
  • Support either Controller as resource, or passing it off to a separate view.
  • Creating States for ui-route, with all of the above.

What I like about this combined with ui-route is the pattern for resources:

@mikew
mikew / 00-README.md
Last active December 31, 2015 04:59
Gitlab -> Jenkins

Installation

  • Set JENKINS_USER and JENKINS_TOKEN environment variables

  • Edit mappings.json and add a push hook in Gitlab to http://localhost:5678/push.php

    OR

Simply add a push hook in gitlab to http://localhost:5678/push.php?project=Jenkins+Project&amp;token=ABCDEF

#!/bin/sh
# Inspired by user rlively
# http://forums.plexapp.com/index.php/user/82346-rlively/
while true; do
clear
curl -s http://127.0.0.1:32400/video/ssp/downloads | grep options-for-current | sed -n 's/.*title="\([^"]*\).*/\1/p'
sleep 2
done

How to backup data from SS Plex

It's an easy process, you just have to copy one folder to any destination of your choosing (ie your Desktop)

Windows

Copy %USER%\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.plugins.wso\

OS X