Skip to content

Instantly share code, notes, and snippets.

View mcka1n's full-sized avatar

Edwin Maldonado mcka1n

View GitHub Profile
@mcka1n
mcka1n / server-log-file.txt
Created July 31, 2015 05:03
WordCleaner logs
2015-07-31 04:53:02,929 ERROR
WordCleaner.Log.LogError(:0)
message: License file not found: C:\Program Files (x86)\WordCleaner7Server\serverlicense.dat
2015-07-31 04:54:07,210 INFO
WordCleaner7Server.WordCleaner6ServerConsole.Main(:0)
message: Total WC run time (secs): 64.2813807
2015-07-31 04:54:11,179 ERROR
WordCleaner.Log.LogError(:0)
#Session controller provides a token
#/controllers/api/sessions_controller.rb
class Api::SessionsController < Devise::SessionsController
before_filter :authenticate_user!, :except => [:create]
before_filter :ensure_params_exist, :except => [:destroy]
respond_to :json
def create
resource = User.find_for_database_authentication(:email => params[:user_login][:email])
return invalid_login_attempt unless resource
@mcka1n
mcka1n / Imagemagick_cheatsheet
Created March 20, 2015 05:40
Imagemagick cheatsheet
# ############################################################
# Convert .jpeg files to a PDF
# 1. I'm using "Scan %d.jpeg"[1-17] because I had picture files
# with the following names:
# Scan 1.jpeg, Scan 2.jpeg ... Scan 17.jpeg
# 2. You can improve the output quality by increasing that
# 50 value
# ############################################################
convert "Scan %d.jpeg"[1-17] -quality 50 my_pdf_file.pdf
/*
* This is a quick and dirty script for copying files in AWS S3 to other buckets.
* This is written so it can work across AWS accounts.
* You can hack in code to apply work or logic to each file.
*
* For each file, it downloads locally to a tmp file and then starts uploading as soon as possible
* and deletes the file immediately when the upload is done.
*
* Best way to use: Spin up a micro in EC2, install node.js,
* create a directory and install the dependencies with
@mcka1n
mcka1n / html5_sdk_node_wrapper.js
Created January 6, 2015 17:57
NodeJS wrapper for C#
var edge = require('edge');
var helloWorld = edge.func(function () {/*
async (input) => {
#r "System.Data.dll"
#r "C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Include\DigitalOfficePro.Html5PointSdk.dll"
using System;
using DigitalOfficePro.Html5PointSdk;
@mcka1n
mcka1n / info
Created December 31, 2014 00:38
Update GoPro password
1. Create an UPDATE folder
2. Inside UPDATE folder create settings.in and update.11.txt files
3. Edit settings.in with the below data:
{
"current_password":"",
"token":"",
"wifi_ap":{
"ssid":"MyCrazyGoProWifiName",
"password":"MySuperPassword"
},
References:
http://blog.carbonfive.com/2012/02/27/supporting-cross-domain-ajax-in-rails-using-jsonp-and-cors/
https://github.com/cyu/rack-cors
http://nelm.io/blog/2011/11/cors-with-sencha-touch/
http://jessehowarth.com/2011/04/27/ajax-login-with-devise
=============================================================================================================
GEMFILE
=============================================================================================================
gem 'rack-cors', :require => 'rack/cors'
@mcka1n
mcka1n / check_keystore
Created February 23, 2014 04:09
How to get your debug keystore | Eclipse
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
## JavaScript
##
syntax "JS" "\.js$" "\.sjs$"
# Reserved Keywords
color yellow "\b(instanceof|typeof|break|do|new|var|case|else|return|void|catch|finally|continue|for|switch|while|this|with|debugger|function|throw|default|if|try|delete|in)\b"
# Future Reserved Words
color brightblue "\b(class|enum|extends|super|import|const|export|implements|let|private|public|yield|static|interface|package|protected)\b"
@mcka1n
mcka1n / heroku_envs
Last active December 26, 2015 09:29
How to set a specific enviroment to Heroku
# Fork heroku app to a staging one.
heroku fork -a project-dev project-staging
# Add new heroku app to git remote
git remote add project-staging [email protected]:project-staging.git
# Set specific enviroment
heroku config:set RACK_ENV=staging RAILS_ENV=staging --remote project-staging