Skip to content

Instantly share code, notes, and snippets.

View monkseal's full-sized avatar

Kevin English monkseal

  • Kenglish.co - Ruby, React.js, Javascript Developer
  • South Lake Tahoe/San Diego/Honolulu
View GitHub Profile
@monkseal
monkseal / provision.sh
Created June 10, 2015 17:10
Provision script for CentOS 6 with Ruby and Postgres 9.4
#!/bin/bash
echo "Installing package dependencies"
sudo yum update
sudo yum install -y apr-devel apr-util-devel autoconf automake curl-devel \
g++ gcc gcc-c++ git glibc-headers httpd-devel libxml2 \
libxml2-devl libxslt libxslt-devel libyaml-devel make \
openssl-devel patch readline \
readline-devel zlib zlib-devel
@monkseal
monkseal / Vagrantfile
Created June 10, 2015 17:13
Vagrantfile for Centos 6.6 with Postgres Port mapped
# Host => Guest (VM)
FORWARD_PORTS = {
3030 => 3030, # webrick
15_432 => 5432 # PostgreSQL
}
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
@monkseal
monkseal / database.yml
Created June 10, 2015 17:19
Modified database.yml with different postgres port
default: &default
adapter: postgresql
encoding: utf8
min_messages: warning
port: 15432
pool: 5
username: blog_user
password: blog_user91x91x
host: 127.0.0.1
@monkseal
monkseal / collect1.go
Created April 2, 2016 09:53
Simple Collect func for an Array or Slice of strings
package main
import "strings"
import "fmt"
func Collect(list []string, f func(string) string) []string {
result := make([]string, len(list))
for i, item := range list {
result[i] = f(item)
}
@monkseal
monkseal / collect2.go
Created April 2, 2016 09:56
Simple Collect func for an Array or Slice of cars
package main
import "fmt"
type car struct {
make string
model string
year int
}
@monkseal
monkseal / collect3.go
Created April 2, 2016 09:58
Broken golang collect
package main
import "fmt"
type car struct {
make string
model string
year int
}
@monkseal
monkseal / fix_thumbdrive.sh
Created April 30, 2017 03:24
Remove ._ files from thumbdrive
# use dot_clean to get rid of things
dot_clean /Volumes/MUSIC16/
# Remove .DS_Store files
find /Volumes/MUSIC16 -name .DS_Store -delete
@monkseal
monkseal / awk-sed-tricks.bash
Last active September 4, 2018 20:29
awk-sed-tricks.bash
# Get 3rd word:
bundle exec rails routes | grep pages | awk '{print $3}'
# Get 3rd word without (format)
bundle exec rails routes | grep pages | awk '{ gsub("\\\(.:format\\\)","",$3); print $3}'
# Run eslint, substitute out full path/ directory for project 'home-page'
yarn run eslint app/javascript | grep javascript | sed -e 's/Users\/v-kevin.english\/Projects\/home-page\///'
@monkseal
monkseal / Policy
Last active January 17, 2018 17:05 — forked from WarlaxZ/Policy
Serverless IAM Requirements
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:DELETE",
"apigateway:GET",
"apigateway:GetResources",
"apigateway:POST",
# get any route path (third item) with 'user' in it.
bundle exec rails routes | grep user | awk '{print $3}'
# get any route path (third item) with 'user' in it.
# NOTE: this removes the trailing (.:format)
bundle exec rails routes | grep user | awk '{ gsub("\\\(.:format\\\)","",$3); print $3}'
# generate a Spec file name from react compoment
find app/javascript/ReactApps/components | sed -e 's/app/spec/' | sed -e 's/\.js/Spec.js/'