Skip to content

Instantly share code, notes, and snippets.

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 Apr 6, 2020
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 Sep 25, 2019 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ahoward
ahoward / web-servers.md
Created Sep 25, 2019 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ahoward
ahoward / a.rb
Created Jan 31, 2019
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 Aug 16, 2018
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)
You can’t perform that action at this time.