Skip to content

Instantly share code, notes, and snippets.

View ivansabik's full-sized avatar

Iván ivansabik

  • Americas
View GitHub Profile
@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
@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."],
@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
@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;
@scottjacobsen
scottjacobsen / git+clone+ssh+agent+forward+sudo
Created December 14, 2012 00:07
Git clone using ssh agent forwarding and sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@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()
@willurd
willurd / web-servers.md
Last active May 7, 2024 04:58
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@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);
@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