Skip to content

Instantly share code, notes, and snippets.

View marcosricardoss's full-sized avatar
:octocat:
committing...

Marcos Ricardo marcosricardoss

:octocat:
committing...
View GitHub Profile
@rduplain
rduplain / README.md
Created October 17, 2011 20:04
Connect to MSSQL using FreeTDS / ODBC in Python.

Goal: Connect to MSSQL using FreeTDS / ODBC in Python.

Host: Ubuntu 11.10 x86_64

Install:

sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy

In /etc/odbcinst.ini:

@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active November 13, 2024 16:11
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@og-shawn-crigger
og-shawn-crigger / jquery.uitotop.min.js
Created August 2, 2012 22:19
UItoTop jQuery Plugin 1.2 by Matt Varone
/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.2 by Matt Varone
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/
(function(a){a.fn.UItoTop=function(d){var f={text:"To Top",min:200,inDelay:600,outDelay:400,containerID:"toTop",containerHoverID:"toTopHover",scrollSpeed:1200,easingType:"linear"},e=a.extend(f,d),c="#"+e.containerID,b="#"+e.containerHoverID;a("body").append('<a href="#" id="'+e.containerID+'">'+e.text+"</a>");a(c).hide().on("click.UItoTop",function(){a("html, body").animate({scrollTop:0},e.scrollSpeed,e.easingType);a("#"+e.containerHoverID,this).stop().animate({opacity:0},e.inDelay,e.easingType);return false}).prepend('<span id="'+e.containerHoverID+'"></span>').hover(function(){a(b,this).stop().animate({opacity:1},600,"linear")},function(){a(b,this).stop().animate({opacity:0},700,"linear")});a(window).scroll(function(){var g=a(window).scrollTop();if(
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@zenideas
zenideas / existing code to git repo
Created October 1, 2012 09:52
Adding existing source to remote git repo
If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (I often do this - you create your remote empty repository in bitbucket/github, then push up your source)
1. Create the remote repository, and get the URL such as git://github.com/youruser/somename.git
2. If your local GIT repo is already set up, skips steps 2 and 3
3. Locally, at the root directory of your source, git init
4. Locally, add and commit what you want in your initial repo (for everything,
git add .
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@yejianye
yejianye / upload_progress.py
Created June 19, 2014 05:18
Show progress bar when uploading a file
# -*- coding: utf-8 -*-
# ############################################################################
# This example demonstrates how to use the MultipartEncoderMonitor to create a
# progress bar using clint.
# ############################################################################
from clint.textui.progress import Bar as ProgressBar
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
@goldsborough
goldsborough / database.py
Created September 3, 2014 10:07
Python Sqlite3 wrapper
###########################################################################
#
## @file database.py
#
###########################################################################
import sqlite3
###########################################################################
#
@tzkmx
tzkmx / jquery-redux-example.js
Created August 11, 2016 23:40
Redux with jQuery simple example
// original from:https://codepen.io/mdd/pen/wGRqbw
// Reducer
const counter = (state = 0, actions) => {
switch (actions.type) {
case 'INCREMENT': return state + 1;
case 'DECREMENT': return state - 1;
default: return state
}
}
@mgeeky
mgeeky / forticlientsslvpn-expect.sh
Last active October 29, 2024 17:14
Simple script intended to automate Fortinet SSL VPN Client connection on Linux using expect scripting.
#!/bin/bash
# Forticlient SSL VPN Client launching script utilizing expect.
# --------------------------------------------
# CONFIGURATION
# If empty - script will take some simple logic to locate appropriate binary.
FORTICLIENT_PATH=""