Skip to content

Instantly share code, notes, and snippets.

View ivansabik's full-sized avatar

Iván ivansabik

  • Americas
View GitHub Profile
@Niklas9
Niklas9 / non-async-tests-mongoose.js
Last active June 29, 2016 17:51
using wait.for to do synchronous gets from MongoDB using Mongoose
var mongoose = require('mongoose');
var wait = require('wait.for');
mongoose.connect('localhost', 'non_async_tests');
var itemSchema = new mongoose.Schema({
name: String
});
var Item = mongoose.model("Item", itemSchema);
@brikis98
brikis98 / Average page views by industry
Created November 2, 2011 03:57
Apache Pig Script Example
pv_by_industry = GROUP profile_view by viewee_industry_id
pv_avg_by_industry = FOREACH pv_by_industry
GENERATE group as viewee_industry_id, AVG(profie_view) AS average_pv;
@jarus
jarus / test.py
Created August 21, 2011 14:52
Testing Flask application with basic authentication
import base64
from myapplication import app
class MyTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
@anderser
anderser / sheet.py
Created October 10, 2011 21:02
Merge multiple excel sheets in one workbook into single sheet workbook
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xlrd
import xlwt
from optparse import OptionParser
import datetime
"""
Merges excel files with multiple sheets with identical header lines into
@sanderhouttekier
sanderhouttekier / install_robomongo.sh
Created April 28, 2014 06:13
This file installs robomongo on your ubuntu / mint linux install
#!/bin/bash -e
# Script for installing Robomongo on Ubuntu.
# Copyright 2013 Binary Birch Tree
# http://www.binarybirchtree.com
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@burnto
burnto / gist:1202437
Created September 8, 2011 02:09
Authorize.net reasons
"""
From http://www.authorize.net/support/merchant/Transaction_Response/Response_Reason_Codes_and_Response_Reason_Text.htm
"""
REASONS = [
# resp code, reason code, reason text, notes
[1, 1, "This transaction has been approved."],
[2, 2, "This transaction has been declined."],
[2, 3, "This transaction has been declined."],
[2, 4, "This transaction has been declined.", "The code returned from the processor indicating that the card used needs to be picked up."],
@johnteske
johnteske / index.html
Created January 5, 2017 18:49
Liquid number format with commas
{% include numberWithCommas.html number=1 %}
{% include numberWithCommas.html number=12 %}
{% include numberWithCommas.html number=123 %}
{% include numberWithCommas.html number=1234 %}
{% include numberWithCommas.html number=12345 %}
{% include numberWithCommas.html number=123456 %}
{% include numberWithCommas.html number=1234567 %}
{% include numberWithCommas.html number=12345678 %}
{% include numberWithCommas.html number=123456789 %}
{% include numberWithCommas.html number=1234567890 %}
@sirkkalap
sirkkalap / Install-Docker-on-Linux-Mint.sh
Last active December 8, 2022 18:38
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@christianroman
christianroman / test.py
Created May 30, 2013 16:02
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()
@fabriceleal
fabriceleal / gist:7803969
Last active February 22, 2024 09:21
Decent enough macro for exporting csvs from Excel.
' http://support.microsoft.com/kb/291296/en-us
' http://superuser.com/questions/130592/how-do-you-force-excel-to-quote-all-columns-of-a-csv-file
' - change integer to long indexing
' http://stackoverflow.com/questions/2524703/save-text-file-utf-8-encoded-with-vba
' - output utf8 content
Sub QuoteCommaExport()
' Dimension all variables.
Dim DestFile As String
Dim FileNum As Integer