Skip to content

Instantly share code, notes, and snippets.

Brian Hogan napcs

Block or report user

Report or block napcs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View notifyMe
notifyMe() {
if [ $? -eq 0 ]; then
osascript -e 'display notification "The command worked" with title "Success"'
else
osascript -e 'display notification "The command failed" with title "Failed"'
fi
}
@napcs
napcs / playbook.yml
Created Jun 22, 2018
playbook for dev server
View playbook.yml
---
- hosts: all
remote_user: root
tasks:
- name: Add "sammy" non-root sudo user
user:
name: sammy
# THIS IS BAD - DON'T PUT PASSWORDS IN PRODUCTION FILES -
View gist:7aee0d0322ca3d362286174816bd7657
sudo apt-get install build-essential libevent-dev libncurses-dev
tar -zxvf tmux-2.4.tar.gz
cd tmux-2.3
./configure
make
sudo make install
@napcs
napcs / flags.elm
Created Apr 8, 2017
Elm with Flags
View flags.elm
module Main exposing (..)
import Html exposing (Html, div, p, text)
-- Data type for the flags
type alias Flags =
{ user : String
, token : String
}
@napcs
napcs / flags.elm
Created Apr 8, 2017
Elm with Flags
View flags.elm
module Main exposing (..)
import Html exposing (Html, div, p, text)
-- Data type for the flags
type alias Flags =
{ user : String
, token : String
}
View game.html
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Game</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>
<script type="text/javascript" src="game.js" charset="utf-8"></script>
View README.md

EFP 47

This is the solution to the "Who's In Space" problem in Exercises For Programmers, implemented in Elm v0.18

This exercise uses the OpenNotify API and that API doesn't support CORS, so you'll need to use a local proxy if you want to make this work in a browser.

But you can use my app QEDProxy as a simple local proxy.

Install it with npm:

@napcs
napcs / TerminalVim.applescript
Last active Oct 13, 2019
Open file in Terminal Vim on OSX
View TerminalVim.applescript
on run {input, parameters}
set filename to POSIX path of input
set cmd to "clear;cd `dirname " & filename & "`;vim " & filename
tell application "iTerm"
tell the current window
@napcs
napcs / ce.rb
Last active Jul 20, 2016
copyedit script - shuffles file contents to help look for errors without being clouded by context.
View ce.rb
# Shuffles file contents to help you find errors without being blinded by context.
# Displays original line number and the line text to help you fix errors.
# usage: ce.rb path/to/file
file = ARGV[0]
File.readlines(file)
.collect.with_index {|line, i| {line: i + 1, text: line} }
.shuffle.each {|line| puts "#{line[:line]}\t#{line[:text]}" }
View pizza_party.elm
import Html.App exposing (beginnerProgram)
import Html exposing(Html, Attribute, button, div, text, span, label, input, p)
import Html.Attributes exposing(value, style, placeholder)
import Html.Events exposing(onClick, onInput)
import String exposing(toFloat)
main =
beginnerProgram {model = model, view = view, update = update}
You can’t perform that action at this time.