Skip to content

Instantly share code, notes, and snippets.

View ZephiroRB's full-sized avatar
🏠
Working from home

Carlos Montalvo ZephiroRB

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.16470588743686676</real>
<key>Green Component</key>
<real>0.20784313976764679</real>
@ZephiroRB
ZephiroRB / nginx.conf
Last active August 29, 2015 14:11 — forked from jrom/nginx.conf
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@ZephiroRB
ZephiroRB / Parser.py
Last active August 29, 2015 14:16 — forked from pbdeuchler/Parser.py
#!/usr/bin/python -tt
#Didn't you hear? The bird is the word!
#@version: 0.1
import sys
def main(filename):
f = open(filename, "r")
f2 = open("log.txt", "w")
count = 0
for line in f:
@ZephiroRB
ZephiroRB / db.rake
Created February 14, 2017 15:06 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@ZephiroRB
ZephiroRB / db.rake
Created February 14, 2017 15:06 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@ZephiroRB
ZephiroRB / ruby_ftp_example.rb
Created February 8, 2018 17:11 — forked from 3dd13/ruby_ftp_example.rb
Sample code of using Ruby Net::FTP library. Login to FTP server, list out files, check directory existence, upload files
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp|
files = ftp.list
@ZephiroRB
ZephiroRB / 20160216211105_create_images.rb
Created February 18, 2018 00:20 — forked from dannyvassallo/20160216211105_create_images.rb
Use tinymce-rails & tinymce-rails-imageupload with carrierwave & fog
# db/migrate/filename.rb
# generate with >> rails g model image alt:string hint:string file:string
class CreateImages < ActiveRecord::Migration[5.0]
def change
create_table :images do |t|
t.string :alt
t.string :hint
t.string :file
@ZephiroRB
ZephiroRB / font_helper.rb
Created February 18, 2018 04:47 — forked from kitwalker12/font_helper.rb
Importing custom fonts in rails
module ActionView
module Helpers
module AssetUrlHelper
def asset_data_base64(path)
asset = Rails.application.assets.find_asset(path)
throw "Could not find asset '#{path}'" if asset.nil?
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
end
end
@ZephiroRB
ZephiroRB / application.scss
Created February 18, 2018 04:53 — forked from goozler/application.scss
Rails 4 fonts (webfonts.ru roboto example)
//= require fonts
@ZephiroRB
ZephiroRB / nginx.conf
Created August 1, 2019 03:02 — forked from mfuzailzubari/nginx.conf
NGINX RTMP Configurations
worker_processes auto;
events {
# Allows up to 1024 connections, can be adjusted
worker_connections 1024;
}
# RTMP configuration
rtmp {
server {
listen 1935; # Listen on standard RTMP port