Skip to content

Instantly share code, notes, and snippets.

View SingularityMatrix's full-sized avatar

SingularityMatrix

  • Earth.
View GitHub Profile
@SingularityMatrix
SingularityMatrix / nsswitch.conf
Created January 29, 2017 13:05
Add nsswitch.conf to shipyard-controller at /etc/ to fix `WARN[0075] Error creating connection: gorethink: dial tcp 81.200.64.50:28015: getsockopt: connection refused`
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the

Keybase proof

I hereby claim:

  • I am singularitymatrix on github.
  • I am smatrix (https://keybase.io/smatrix) on keybase.
  • I have a public key ASBIS4WpejZn_DL03_VTl6f4sT_Y3S3ZrSW15WV1Vxowlwo

To claim this, I am signing this object:

@SingularityMatrix
SingularityMatrix / README.md
Created August 17, 2016 13:57 — forked from joakimk/README.md
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

@SingularityMatrix
SingularityMatrix / styles.less
Created February 22, 2016 11:12 — forked from brandondurham/styles.less
Using Operator Mono in Atom
/**
* Using Operator Mono in Atom
*
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
*
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png):
@SingularityMatrix
SingularityMatrix / index.md
Last active September 22, 2015 12:00 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@SingularityMatrix
SingularityMatrix / custom_logger.rb
Last active August 29, 2015 14:27 — forked from kinopyo/custom_logger.rb
Custom logger file in Rails
# lib/custom_logger.rb
class CustomLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
logfile = File.open("#{Rails.root}/log/custom.log", 'a') # create log file
logfile.sync = true # automatically flushes data to file
CUSTOM_LOGGER = CustomLogger.new(logfile) # constant accessible anywhere
@SingularityMatrix
SingularityMatrix / backup.rake
Last active August 29, 2015 14:26 — forked from rantoniuk/backup.rake
Rake task for backing up MySQL database in Rails projects
namespace :db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7"
task :backup => [:environment] do
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S")
base_path = Rails.root
base_path = File.join(base_path, ENV["DIR"] || "backups")
backup_base = File.join(base_path, 'db_backups')
backup_folder = File.join(backup_base, datestamp)
backup_file = File.join(backup_folder, "#{RAILS_ENV}_dump.sql")
FileUtils.mkdir_p(backup_folder)
db_config = ActiveRecord::Base.configurations[RAILS_ENV]
@SingularityMatrix
SingularityMatrix / xlsx_parsing.rb
Created June 16, 2015 13:35
Parsing xlsx files with RubyXL, and some other thoughts
# To be written
@SingularityMatrix
SingularityMatrix / barcodes_in_ruby.rb
Created June 16, 2015 13:35
Working with Barcodes in Ruby
# To be written