Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Ivovich danivovich

View GitHub Profile
@danivovich
danivovich / zube_to_csv.rb
Last active Aug 11, 2021
Zube JSON to CSV
View zube_to_csv.rb
require 'json'
require 'csv'
data = JSON.parse(File.read("data.json"))
out = CSV.open("data.csv", "wb")
out << ["Number", "State", "Status", "Column", "Epic", "Labels", "Title", "Body"]
row = []
View AREADME.md

Updating timex_ecto and ecto on a project created a situation where we can no longer run migrations when deployed via distillery.

Running migrations on Heroku and locally when exected as a mix task continue to work. This specific lock diff causes the migration command to fail as shown in the output. Nothing about the database or its connection string changes between deploys with and without this diff applied.

Since we cannot update just timex_ecto or just ecto, I'm unclear as to which the issue is with, and since neither breaks a non-distillery release migration (mix ecto.migrate mechanism) it could be something specific about how distillery interacts with these two updates.

@danivovich
danivovich / migrate_ghost_to_jekyll.rb
Created Oct 27, 2017
Migrate from Ghost JSON into Jekyll Markdown Files
View migrate_ghost_to_jekyll.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'date'
require 'yaml'
FileUtils.mkdir_p("_posts")
FileUtils.mkdir_p("_drafts")
FileUtils.mkdir_p("_data")
@danivovich
danivovich / nginx-ghost.conf
Created Jun 24, 2016
Basic nginx configuration for a caching proxy for ghost blogging, designed for use in Docker
View nginx-ghost.conf
server {
listen 80 default_server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~* \.(jpg|jpeg|svg|png|gif|ico|css|js|eot|woff)$ {
proxy_cache GHOST;
View keybase.md

Keybase proof

I hereby claim:

  • I am danivovich on github.
  • I am danivovich (https://keybase.io/danivovich) on keybase.
  • I have a public key ASCxJr_4CBEf8zxo6eyWMYfW24NpG3zQlwRI6-0Jkj6Vowo

To claim this, I am signing this object:

@danivovich
danivovich / deps.rb
Created Feb 13, 2015
ruby-build deps for chef
View deps.rb
%w(autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev).each do |pkg|
package pkg
end
@danivovich
danivovich / ladders.go
Created Sep 10, 2013
Chutes and Ladders in Go
View ladders.go
package main
import (
"fmt"
"math/rand"
"os"
"text/tabwriter"
"time"
)
@danivovich
danivovich / gunicorn.conf.py
Created Mar 12, 2013
Graceful restarts with code reloading on Capistrano style deployed Python applications
View gunicorn.conf.py
import os
import signal
bind = "127.0.0.1:8888"
errorlog = "%s/log/gunicorn.log" % (os.getcwd())
workers = 4
keepalive = 5
preload_app = True
def on_starting(server):
@danivovich
danivovich / static_assets.rake
Last active Dec 11, 2015
replace links to assets in static error pages with links to hashed asset pipeline assets
View static_assets.rake
namespace :assets do
desc 'Update the URIs for assets used in the static pages (e.g. 500.html)'
task :update_static_pages => :environment do
manifest_path = Rails.root.join('public', 'assets', 'manifest.yml')
unless File.exists?(manifest_path.to_s)
raise "Must run assets:precompile first"
end
manifest = YAML.load(manifest_path.read)
%w[404 422 500 504 browser].each do |static_page|
path = Rails.root.join('public', "#{static_page}.html")
@danivovich
danivovich / render_the_page_steps.rb
Created Jun 14, 2012
Capybara Webkit save and open page but with render
View render_the_page_steps.rb
Then /^render the page$/ do
if Capybara.current_driver == Capybara.javascript_driver
file_name = "capybara-webkit-#{Time.new.strftime("%Y%m%d%H%M%S")}#{rand(10**10)}.png"
name = File.join(*[Capybara.save_and_open_page_path, file_name].compact)
page.driver.render name
begin
require "launchy" # could raise LoadError
raise LoadError unless Launchy::Version::MAJOR >= 2
Launchy.open(name)
rescue LoadError