Skip to content

Instantly share code, notes, and snippets.

View gstark's full-sized avatar

Gavin Stark gstark

View GitHub Profile

Leaving this gist in the hopes that this helps someone some day.

I was using a docker image with Alpine linux. In this docker container I installed a specific version of node via several methods (nodenv, asdf, etc.) and each time I had to add the gcompat package so I could run glibc applications.

When I tried to install many npm packages such as yarn and corejs and others I would get the error:

Error: spawn sh ENOENT

I belive I finally realized that Error: spawn sh ENOENT is happening since npm is trying to launch sh and there is some incompatibility with a glibc app running with gcompat trying to launch a non-glibc app like sh

@gstark
gstark / .irbrc
Created May 29, 2019 14:22
irbrc for suncoast handbook
require 'irb/completion'
require 'irb/ext/save-history'
# Require awesome_print in our environment
begin
require 'awesome_print'
rescue LoadError
end
# Keep an IRB history
def sum_groups(arr)
loop do
chunks = arr.chunk(&:even?).map(&:last)
return arr.length if chunks.all? { |list| list.size == 1 }
arr = chunks.map(&:sum)
end
end
@gstark
gstark / snake_case.rb
Created April 7, 2016 18:23
ACR 2016 snake case code challenge
# Take the smallest case possible, a one wide grid
#
# .
#
# The number of ways of navigating this is 1 (do nothing)
#
# 1
#
# Extending this to a 2x2 grid still has the 0 case
#

For the numbers 1 through 1000

  • if the number is divisible by 5 print Iron

  • if the number is divisible by 7, print Yard

  • if it is divisible by both 5 and 7, print IronYard

  • that is:

1
@gstark
gstark / 01 Intro to Rails Crash Course.md
Last active March 29, 2018 14:24
Intro to Rails Crash Course

Weclome to the Iron Yard Intro to Rails Crash Course

First step is to install the correct version of the Ruby environment:

rvm install ruby-2.4.2
%tr
%td{:align => "left", :height => "21", :valign => "bottom"}
%font{:color => "#000000"}
%br/
- 20.times do
%td{:align => "left", :valign => "bottom"}
%font{:color => "#000000"}
%br/
require 'minitest/autorun'
GREEN_EGGS_AND_HAM = %{
I am Sam
Sam I am
That Sam-I-am
That Sam-I-am!
I do not like that Sam-I-am
@gstark
gstark / terminal_kittens.rb
Created May 19, 2015 19:48
Kittens in your terminal, how awesome!
require "base64"
require "open-uri"
def url_to_terminal_image(url)
raw_image = open(url).read
encoded_image = Base64.encode64(raw_image).gsub(/[\n\r]/,'')
"\033]1337;File=size=#{raw_image.length};inline=1:#{encoded_image}\a\n"
end
BIG_BEFORE="big before"
BIG_AFTER="big after"
GARBAGE="garbage"
REGEXP=/big /
$big_after_id = 0
$big_before_id = 0
$callable_id = 0