Skip to content

Instantly share code, notes, and snippets.

@JayTeeSF
JayTeeSF / pem-split
Last active August 29, 2015 21:34 — forked from jinnko/pem-split
Take a PEM format file as input and split out certs and keys into separate files.
#!/usr/bin/awk -f
#
# Take a PEM format file as input and split out certs and keys into separate files
#
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } }
/-----BEGIN RSA PRIVATE KEY-----/ { key=1; cert=0 }
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 }
split_after == 1 { n++; split_after=0 }
/-----END CERTIFICATE-----/ { split_after=1 }
require "./compiler/crystal/**"
while line = gets
compiler = Crystal::Compiler.new
program = Crystal::Program.new
program.target_machine = compiler.target_machine
prelude = program.normalize(Crystal::Require.new("prelude"))
@JayTeeSF
JayTeeSF / rails http status codes
Created October 7, 2015 14:29 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@JayTeeSF
JayTeeSF / sonic_pi_examples.txt
Created December 18, 2015 18:48 — forked from darinwilson/sonic_pi_examples.txt
Sonic Pi Examples
##############################################
## Example 1 - play a note
play 60
##############################################
## Example 2 - play 4 random notes
4.times do
play rrand_i(60, 90)
sleep 0.5
@JayTeeSF
JayTeeSF / authlogic-to-devise.md
Created January 3, 2018 16:27 — forked from rpheath/authlogic-to-devise.md
Steps and troubleshooting tips when moving Authlogic to Devise.

How To: Authlogic to Devise

Step 1: Migration

  1. bin/rails g migration AuthlogicToDevise
  2. (see the file below for the actual migration, authlogic_to_devise.rb)
  3. bin/rake db:migrate

Step 2: Update Gemfile

  1. gem "devise", "~> 2.2.0"
  2. bundle install
@JayTeeSF
JayTeeSF / automobile.ipynb
Created January 30, 2018 18:29 — forked from martinwicke/automobile.ipynb
Estimator demo using Automobile dataset
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JayTeeSF
JayTeeSF / mysql.py
Last active February 12, 2018 18:59 — forked from naiquevin/mysql.py
Examples of Mysql programming in Python
#!/usr/bin/env python
# first, on cli: pip install mysqlclient
## Mysql-Python basic examples.
## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/)
## Gist created only for quick reference purpose
import sys
// import _mysql
@JayTeeSF
JayTeeSF / copy_attachments.rb
Created March 14, 2018 21:26 — forked from airblade/copy_attachments.rb
Copies S3-stored Paperclip attachments from one AR model to another
# lib/paperclip/copy_attachments.rb
# Copies S3-stored Paperclip attachments from one AR model to another.
#
# This module should be mixed into the target AR model.
if Gem::Version.new(::AWS::VERSION) >= Gem::Version.new(2)
raise NotImplementedError, 'coded for aws-sdk v1'
end
@JayTeeSF
JayTeeSF / application.html.erb
Created June 5, 2019 21:48 — forked from Dagnan/application.html.erb
Inline CSS or JS in Rails 5
<!DOCTYPE html>
<html>
<head>
<%= inline_js 'application.js' %>
<%= inline_css 'application.css' %>
</head>
<body>
</body>
</html>