Skip to content

Instantly share code, notes, and snippets.

require 'excon'
Excon.defaults[:ssl_verify_peer] = false
Excon.defaults[:ssl_ca_path] = ' /usr/lib/ssl'
CarrierWave.configure do |config|
if Rails.env.production? || Rails.env.staging?
config.storage = :fog
config.fog_credentials = {
provider: 'AWS',
@ryaz
ryaz / oracle_queries
Last active August 29, 2015 14:16
oracle sys_dba stuff
### Open cursors
select max(a.value) as highest_open_cur, p.value as max_open_cur
from v$sesstat a, v$statname b, v$parameter p
where a.statistic# = b.statistic#
and b.name = 'opened cursors current'
and p.name = 'open_cursors'
group by p.value;
### Find out the session that is causing the error by using the following SQL statement:
select a.value, s.username, s.sid, s.serial#
@ryaz
ryaz / serilize accessors
Created April 6, 2015 13:20
serilize accessors
serialize :preferences
#helper for using serialized values in form
def self.serialized_attr_accessor(*args)
args.each do |method_name|
eval "
def #{method_name}
(self.preferences || {})[:#{method_name}]
end
def #{method_name}=(value)
@ryaz
ryaz / oracle_mac
Created April 10, 2015 12:01
oracle support for mac os x
1. download from https://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BJFHJIBH
- instantclient-basic-macos.x64-11.2.0.3.0.zip
- instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
- instantclient-sdk-macos.x64-11.2.0.4.0.zip
2. unpack and place to /opt/oracle/instantclient_11_2
3. set proper permissions
4. in ~/.bash_profile
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/oracle/instantclient_11_2
export DYLD_LIBRARY_PATH
PATH=$PATH:/oracle/instantclient_11_2/
@ryaz
ryaz / vast.xml
Last active September 23, 2015 15:01
<!--RNMD:DATA:{"eid": "10.210.3.18.6b3b78f8-ec11-4a99-8906-b7976aad75c2"} ;END-->
<VAST version="2.0">
<Ad id="2383240">
<InLine>
<AdSystem>Rhythm NewMedia</AdSystem>
<AdTitle>audi</AdTitle>
<Description>Rhythm NewMedia</Description>
<Impression id="Rhythm NewMedia">
<![CDATA[http://awsstageepg.aws.rnmd.net/adAck?requestId=102103181443020449282687&id=2383240&user=10.210.3.18.6b3b78f8-ec11-4a99-8906-b7976aad75c2&appId=tmzus_android&completed=100&trackingType=noQuartile]]></Impression>
<Creatives>
@ryaz
ryaz / aws-transcode.rb
Created October 14, 2015 16:46 — forked from bgkittrell/aws-transcode.rb
Uploads a directory of files to s3 and creates elastic transcoder jobs. Requires the aws-sdk gem. Usage ruby aws-transcode.rb /path/to/videos
require 'aws'
AWS.config(:access_key_id => 'XXXXX', :secret_access_key => 'XXXXX')
pipeline_id = 'XXXXXXX'
preset_id = 'XXXXXX'
s3 = AWS::S3.new
bin = s3.buckets['XXXXXX-in']
bout = s3.buckets['XXXXXX-out']
<label class="switch"><input type="checkbox" checked><i></i></label>
<label class="switch red"><input type="checkbox"><i></i></label>
.switch input {
display: none;
}
.switch i {
display: inline-block;
cursor: pointer;
padding-right: 20px;
@ryaz
ryaz / gist:b2ae30f6fcb7f801c9e4e8cc29b03085
Created June 21, 2016 00:46
Notes for install rails project on ubuntu
- check run commands as login shell in terminal profile preferences after you install rvm and open new tab
- `sudo apt-get install nodejs postgresql postgresql-contrib git npm phantomjs libpq-dev`
- `sudo npm install bower -g`
- `sudo ln -s which nodejs/usr/bin/node`
- add ubuntu superuser:
ubuntu@ubuntu-amd64:~/Sites/webapp$ sudo -i -u postgres
postgres@ubuntu-amd64:~$ createuser --interactive
Enter name of role to add: ubuntu
@ryaz
ryaz / login_helper.rb
Created August 5, 2016 23:48 — forked from theotherdon/login_helper.rb
Login a User programatically with ng-token-auth.
def login_user_programatically
# User or whatever the name of the model is that you're trying to authenticate
@request.env['devise.mapping'] = Devise.mappings[:user]
@resource = FactoryGirl.create(:confirmed_user)
# The following two lines are where the magic happens.
@auth_headers = @resource.create_new_auth_token
@request.headers.merge!(@auth_headers)
end
@ryaz
ryaz / aws-multipartUpload.js
Created September 22, 2016 22:36 — forked from sevastos/aws-multipartUpload.js
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;