Skip to content

Instantly share code, notes, and snippets.

@spk
spk / deploy.yaml
Created Jan 7, 2020
Github Action Heroku Git Deploy
View deploy.yaml
# https://github.com/marketplace/actions/checkout
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issue-comment-event-issue_comment
# https://devcenter.heroku.com/changelog-items/775
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# https://github.com/cirrus-actions/rebase#installation
# https://github.com/actions/heroku/issues/10
---
name: Deploy to HEROKU_APP_NAME
on:
@spk
spk / Dockerfile
Created Oct 23, 2019
docker lua pretty build
View Dockerfile
FROM alpine
RUN apk add --no-cache \
bash \
build-base \
ca-certificates \
cmake \
curl \
gcc \
git \
@spk
spk / LICENSE.md
Last active Feb 1, 2017 — forked from tommaybe/LICENSE.md
Day / Hour Heatmap
View LICENSE.md

Copyright (c) 2016, Tom May

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH

View version.diff
diff --git a/app/models/version.rb b/app/models/version.rb
index e8eed16..a3a4ba1 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -36,10 +36,10 @@ class Version < ActiveRecord::Base
GemDownload.create!(count: 0, rubygem_id: rubygem_id, version_id: id)
end
- def self.reverse_dependencies(name)
+ def self.reverse_dependencies_by(**kwargs)
@spk
spk / alternative-ruby.sh
Created Feb 3, 2016
Quick Ruby alternative on Debian
View alternative-ruby.sh
RV=2.2; dpkg -L ruby$RV | grep 'bin/' | grep -v grep | awk '{print "ln -fs "$1" "$1}' | sed s/$RV//2 | sed 's/\/usr/$HOME/2' | sh
@spk
spk / bundler.cap
Created May 20, 2015
Bundler check install capistrano 3
View bundler.cap
namespace :bundler do
task :check_install do
on roles(:app) do
with rails_env: fetch(:rails_env) do
execute 'gem query --local | grep bundler || gem install bundler'
end
end
end
end
@spk
spk / clock.sh
Last active Dec 17, 2015 — forked from oz/clock.sh
View clock.sh
#!/bin/sh
time_here=`date`
#COL=$(tput cols)
COL=60
AWESOME_TZ="UTC America/Los_Angeles America/Mexico_City America/New_York Europe/Paris Europe/Berlin Asia/Tokyo"
echo 'Awesome world clock:'
echo
@spk
spk / reindex.rake
Last active Dec 15, 2015
Regenerate all ES indexes
View reindex.rake
# encoding: UTF-8
namespace :indexes do
desc "Regenerate all ES indexes"
task :regenerate => [:environment] do
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
if model.respond_to?(:tire)
puts "* (Re)generating indexes for model #{model.name}"
sh "bundle exec rake environment tire:import CLASS='#{model.name}'"
View extract_cookies.sh
#!/usr/bin/env sh
#$ extract_cookies $HOME/.mozilla/firefox/*/cookies.sqlite > /tmp/cookies.txt
#$ wget --load-cookies=/tmp/cookies.txt http://mysite.com
#$ # OR
#$ curl --cookie /tmp/cookies.txt http://mysite.com
cleanup() {
rm -f $TMPFILE
exit 1
}
@spk
spk / populate.rake
Created Mar 14, 2012
Populate tasks template
View populate.rake
# encoding: utf-8
namespace :db do
I18n.locale = :en
desc "initialize"
task :init => [:environment] do
raise "\n Please run `rake db:seed` before" if User.all.blank?
require 'ffaker'