Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
View GitHub Profile
View this_source.py
s = """Gur Mra bs Clguba, ol Gvz Crgref
Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
@ahoward
ahoward / a.sh
Created April 6, 2020 18:27
fixes "# mesg: ttyname failed: Inappropriate ioctl for device" warnings during docker build
View a.sh
# fixes "# mesg: ttyname failed: Inappropriate ioctl for device" warnings when building docker
#
echo '#! /bin/sh' > /usr/bin/mesg
chmod 755 /usr/bin/mesg
# all this does is replace the 'mesg' command with a no-op that always succeeds.
# do this *early* in your Dockerfile somewhere.
# from a security persprective this is also fine because it relates to multi-user unix systems,
# not single user/contrained docker images.
@ahoward
ahoward / web-servers.md
Created September 25, 2019 16:27 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md
@ahoward
ahoward / web-servers.md
Created September 25, 2019 16:27 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md
@ahoward
ahoward / a.rb
Created January 31, 2019 16:36
rails just *cannot* run in threads. doing even simple things will bork it in strange and magical ways
View a.rb
class A
attr_accessor :dsl
attr_accessor :state
def initialize
@state = []
@dsl = self.class.dsl
sleep(rand)
@ahoward
ahoward / example.rb
Created August 16, 2018 18:19
even though i author'd main.rb - which is a really complete cli tool, i 've been yearning for something simpler for writing small cli tools. eg. in a rails ./scripts/ directory...
View example.rb
#! /usr/bin/env ruby
require_relative '../lib/script.rb'
script {
help '
HELP!
'
run {
View a.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
//
import Vue from 'vue'
import App from './App'
import router from './router'
import firebase from 'firebase'
Vue.config.productionTip = false
View a.rb
#
require 'open-uri'
require 'json'
#
module TargetSmartStateDictionary
def TargetSmartStateDictionary.url
@url ||= (
'https://gist.githubusercontent.com/mshafrir/2646763/raw/8b0dbb93521f5d6889502305335104218454c2bf/states_hash.json'
)
View a.rb
module Util
def mongo_cluster_command_line_options
#
Mongoid.default_client # Force the setting to be parsed
settings = Map.for(Mongoid.clients[:default])
address = settings[:uri]
#
unless address && address =~ %r`://`
raise("no uri in #{ settings.inspect }")
View rails_root.rb
# sometimes you need to calculate the rails_root from a subdirectory of a rails' app, eg, lib/capistrano/tasks/db.rake
# this code does it properly, but is verbose. golf it!
#
rails_root = File.expand_path(Dir.pwd)
until rails_root == '/'
if %w[ Gemfile app public ].all?{|entry| test(?e, "#{ rails_root }/#{ entry }")}
break
else
rails_root = File.dirname(rails_root)