Skip to content

Instantly share code, notes, and snippets.

View RickCogley's full-sized avatar
👻
Slowly but surely implementing ISO 27001 ISMS

Rick Cogley RickCogley

👻
Slowly but surely implementing ISO 27001 ISMS
View GitHub Profile
@RickCogley
RickCogley / Mac OS X Folder Action Upload Screenshot to Google Drive.sh
Last active September 6, 2024 10:11
Mac OS X Folder Action Upload Screenshot to Google Drive.sh
#!/bin/bash
# Author: Rick Cogley
# Updated: 27 Jan 2016
# Purpose: For use in a Mac OS X automator action, set to watch a screenshot folder.
# Assumes:
# GOPATH is set
# drive is installed (https://github.com/odeke-em/drive)
# there is a folder initialized with "drive init"
DRIVEINITPATH=$HOME/gdrive
@RickCogley
RickCogley / package.json
Created February 15, 2016 11:35
Basscss Upgrade to v8
{
"name": "RCC",
"version": "1.5.2",
"description": "Rick Cogley Central.",
"author": {
"name": "Rick Cogley",
"email": "[email protected]",
"url": "http://rick.cogley.info"
},
"license": "MIT",
@RickCogley
RickCogley / togglehidden.sh
Created February 19, 2016 09:52
Toggle Hidden Files in Mac OS X Finder
#!/bin/bash
#
# Author : Rick Cogley
# Created : 19 Feb 2016
#
showallfiles=$(defaults read com.apple.finder AppleShowAllFiles)
case "$showallfiles" in
1|TRUE|True|true|YES|Yes|yes) defaults write com.apple.finder AppleShowAllFiles -boolean false
echo Hidden files covered
;;
@RickCogley
RickCogley / README.md
Created February 23, 2016 06:34 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@RickCogley
RickCogley / grok_vi.mdown
Created April 6, 2016 14:12 — forked from nifl/grok_vi.mdown
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

@RickCogley
RickCogley / on-exit_git.py
Last active August 10, 2021 15:01 — forked from wbsch/on-exit_git.py
Proof of concept for a Taskwarrior on-exit hook that manages a git repository in ~/.task
#!/usr/bin/env python
#
# PoC: Manage a git repository in ~/.task that gets updated on changes.
# Only pending.data and completed.data are included by default.
# You can use "git add" to add whatever files you want to track in your
# task folder.
#
# Inspired by https://gist.github.com/Unode/9366218
#
# Works with any Taskwarrior version that supports hooks.
if [[ -o login ]]; then
if [ "$TERM" != "screen" -a "$ITERM_SHELL_INTEGRATION_INSTALLED" = "" ]; then
export ITERM_SHELL_INTEGRATION_INSTALLED=Yes
# Indicates start of command output. Runs just before command executes.
iterm2_before_cmd_executes() {
printf "\033]133;C;\007"
}
iterm2_set_user_var() {
printf "\033]1337;SetUserVar=%s=%s\007" "$1" $(printf "%s" "$2" | base64)
@RickCogley
RickCogley / vimrc
Created April 25, 2016 06:12 — forked from romainl/deprecation.md
Idiomatic vimrc
" Keeping your lovely 'vimrc' INSIDE of your 'vim' directory is a good idea,
" if only because it makes it easier to move your config around.
" If you are using 7.4 exclusively, the following will be enough:
"
" on Unix-like systems ~/.vim/vimrc
" on Windows %userprofile%\vimfiles\vimrc
" If you use both 7.4 and an older version, or only an older version,
" the simplest, future-proof, solution is to put this line and only
@RickCogley
RickCogley / output.log
Created June 18, 2016 14:36
SimpleChatPython.py Try vector.im
~/d/m/samples ❯❯❯ ./SimpleChatClient.py master ✱
Host (ex: http://localhost:8008 ): https://vector.im
Username: rickcogley
Password:
Room ID/Alias: !QaRABAkxDBNukDoCOY:matrix.org
503: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Temporarily Unavailable</title>
</head><body>
<h1>Service Temporarily Unavailable</h1>
@RickCogley
RickCogley / curl-to-matrix-text-readme.md
Last active February 25, 2024 01:45
Testing curl to matrix.org

Testing the matrix.org client-server API

Matrix is:

an open standard for decentralised communication, providing simple HTTP APIs and open source reference implementations for securely distributing and persisting JSON over an open federation of servers.

It's pretty fantastic, if you think on the massive problem of fragmentation all across the web. They've created an easy to use API, and you can do a kludgy test using curl from the terminal (*nix, mac, win). See: http://matrix.org/docs/howtos/client-server.html

It's pretty straightforward to do a quick test. I have an account at https://matrix.org / https://vector.im, so I used that to get a token.