Skip to content

Instantly share code, notes, and snippets.

View neophiliac's full-sized avatar

Kurt Sussman neophiliac

View GitHub Profile

Poor Man's Deploy

  • Start a Sinatra server on port 4000
  • GET / to that server triggers a git pull and mod_rails restart
  • Hit port 4000 locally after pushing

Why?

#!/usr/bin/env ruby
#
# Originally written by http://redartisan.com/tags/csv
# Added and minor changes by Gavin Laking
# more changes by Kurt Sussman (don't expect 'id' in col#1, no attribute if no data)
#
# "id","name","mime_type","extensions","icon_url"
# "1","unknown","unknown/unknown","||","/images/icon/file_unknown.gif"
# "2","image/tiff","image/tiff","|tiff|tif|","/images/icon/blank.png"
#
def extract_model_name(controller_class); controller_class.to_s.match(/(.+)Controller/)[1]; end
def model(controller_class); extract_model_name(controller_class).singularize.constantize; end
def symbol_for_model(controller_class, options = {})
tablename = extract_model_name(controller_class).tableize
options[:pluralize] ? tablename.to_sym : tablename.singularize.to_sym
end
describe "an ordinary 'show' action", :shared => true do
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@neophiliac
neophiliac / TechDecisions.md
Created November 30, 2011 19:43
Choices to make in a new Rails project. Would love to see this forked with other's opinions.

Team Support

Source Code Control

git (private server)
Alternative: github

Time Tracking

Cashboard

@neophiliac
neophiliac / .rubyconfig
Created July 9, 2012 05:57
Rails Dev Setup Ubuntu 11.10 rbenv
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
# in .bashrc:
#
# if [ -f ~/.rubyconfig ] ; then
# . ~/.rubyconfig
@neophiliac
neophiliac / README.md
Created November 11, 2016 22:00 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@neophiliac
neophiliac / https.go
Created January 8, 2018 01:37 — forked from kennwhite/https.go
Simple https http/2 static web server with HSTS & CSP (A+ SSLLabs & securityheaders.io rating) in Go using LetsEncrypt acme autocert
package main
import (
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
"log"
"net"
"net/http"
)
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@neophiliac
neophiliac / ublock_custom_scripts.js
Created April 9, 2022 20:57 — forked from varenc/ublock_custom_scripts.js
uBlock origin custom scripts
# Expires: 5 minutes
# License: See source for license and credits
nano-tiny-noopvast-2.0 text/xml
<VAST version="2.0"></VAST>
disable-webassembly.js application/javascript
(function() {
delete WebAssembly;
console.log('CV SAYS: WebAssembly deleted')