Skip to content

Instantly share code, notes, and snippets.

View knxroot's full-sized avatar

Gustavo Lacoste knxroot

View GitHub Profile
@rbonvall
rbonvall / rut.py
Created July 5, 2010 23:56
Dígito verificador del RUT en Python
# encoding=utf-8
# Obtener el dígito verificador del RUT en Python.
#
# La función recibe el RUT como un entero,
# y entrega el dígito verificador como un entero.
# Si el resultado es 10, el RUT es "raya k".
from itertools import cycle
@tathamoddie
tathamoddie / RequiresPowerShell.bat
Created August 5, 2010 03:48
Batch file to automatically detect, download and install PowerShell 2 on to an XP SP3 machine
@echo off
REM If PowerShell 2 is not installed, this script will automatically download and install it.
REM Only works on XP SP3 with .NET 3.5. Only for dev boxes, not designed for servers.
REM Based on http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/
ver | find "XP" > nul
if %ERRORLEVEL% neq 0 goto not_xp
ver | find "5.1.2600" > nul
@nuclearsandwich
nuclearsandwich / mysqldump_pre_commit_hook.bash
Created April 6, 2011 00:30
A pre-commit hook for git which dumps and adds a mysql database to the repository just before commit.
#!/bin/bash
# Pre-commit hook to make a mysql dump right before committing and add it to the commit.
#
## Change the following values to suit your local setup.
# The name of a database user with read access to the database.
DBUSER=root
# The password associated with the above user. Leave commented if none.
#DBPASS=seekrit
# The database associated with this repository.
DBNAME=dplay
@gabceb
gabceb / ConvertXLS.ps1
Created May 3, 2011 22:36
Powershell script to convert all xls documents to xlsx in a folder recursively
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook
write-host $xlFixedFormat
$excel = New-Object -ComObject excel.application
$excel.visible = $true
$folderpath = "C:\Users\gabceb\Documents\testXLS"
$filetype ="*xls"
Get-ChildItem -Path $folderpath -Include $filetype -recurse |
ForEach-Object `
{
$path = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))
@wallymathieu
wallymathieu / CSharp_loose.flt
Created November 18, 2011 12:12
Winmerge filter (svn + git)
## This is a directory/file filter for WinMerge
## This filter suppresses various binaries found in Visual C# source trees
name: Visual C# loose
desc: Suppresses various binaries found in Visual C# source trees
## This is an inclusive (loose) filter
## (it lets through everything not specified)
def: include
## Filters for filenames begin with f:
@jelcaf
jelcaf / Operaciones-Git
Last active September 25, 2024 03:12
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@jpoehls
jpoehls / encoding-helpers.ps1
Created April 17, 2012 14:54
Convert-FileEncoding and Get-FileEncoding
<#
.SYNOPSIS
Converts files to the given encoding.
Matches the include pattern recursively under the given path.
.EXAMPLE
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8
#>
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') {
$count = 0
@jpoehls
jpoehls / exec.ps1
Created May 31, 2012 14:25
PowerShell Exec function from psake
# Taken from psake https://github.com/psake/psake
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
@Dnefedkin
Dnefedkin / BIPCatalogUtil.cmd
Created October 26, 2012 12:09
Runs BI Publisher Catalog Utility on Windows OS
@ECHO OFF
setLocal EnableDelayedExpansion
@REM *************************************************************************
@REM Purpose: Runs BI Publisher Catalog Utility on Windows OS
@REM Author: Dmitry Nefedkin ([email protected])
@REM Description: script is based on BIPCatalogUtil.sh
@REM found in $MW_HOME\Oracle_BI1\clients\bipublisher\ of Oracle BI EE 11.1.1.6 installation
@REM Last changed: Oct, 25, 2012 18:00
@REM Version: 0.1
@REM *************************************************************************
@ctokheim
ctokheim / pandas_tricks.py
Last active September 14, 2016 13:28
Python: tricks
import pandas as pd
import numpy as np
# read df from delimited file
df = pd.read_csv('filename.txt', sep='\t')
# force printing out of dataframe
print df.to_string()
# apply a function to column/row