Skip to content

Instantly share code, notes, and snippets.

View xoner's full-sized avatar
🐍
Python Rocks!

David Pascual Rocher xoner

🐍
Python Rocks!
View GitHub Profile
@xoner
xoner / GenPasswd.psd1
Created June 5, 2012 08:51
PowerShell module to generate random passwords through System.Web.Membership.GeneratePassword
#
# Manifiesto del módulo 'GenPassword'
#
# Generado por David Pascual Rocher
#
# Generado el 12/04/2012
#
@{
@xoner
xoner / Posh-SysinternalsUpdater.psm1
Created June 5, 2012 10:13
PowerShell module to update the sysinternals suite taking as reference the utilites published in \\live.sysinternals\tools
Set-StrictMode -Version 2.0
function Sysinternals-Updater
{
Param
(
[Parameter(Mandatory=$false)]
[Switch]
$checkOnly = $false,
@xoner
xoner / QUERY_OCS_SOFTWARE.sql
Created June 15, 2012 09:22
Simple query to get the software installed across the computers.
USE ocsweb;
SELECT H.NAME, S.NAME, S.VERSION
FROM softwares S, hardware H
where S.NAME LIKE '%SoftwareName%' AND H.ID = S.HARDWARE_ID;
@xoner
xoner / movewin.sh
Created June 18, 2012 06:39
Move windows between monitors in a multimunitor setup in linux
#!/bin/bash
#++++++++++++++++
# Monitor Switch
#
# Moves currently focused window from one monitor to the other.
# Designed for a system with two monitors.
# Script should be triggered using a keyboard shortcut.
# If the window is maximized it should remain maximized after being moved.
# If the window is not maximized it should retain its current size, unless
# height is too large for the destination monitor, when it will be trimmed.
@xoner
xoner / index.php
Created June 28, 2012 07:52
Simple php script that redirects the request to the download of the QS version team viewer. Excellent for setting up in http://your.site.com/support/ and tell your colleages to just push execute.
<?php
header('Location: http://www.teamviewer.com/download/TeamViewerQS-wu.exe');
exit(0);
@xoner
xoner / fstab
Created July 2, 2012 07:08
Some useful examples of fstab
# Bind FS mount example
bindfs#/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media /var/www/django-media fuse owner=www-data,group=www-data 0 0
# CIFS mount example
//WindowsFiler/SharedFolder /unix/path/to/folder cifs rw,uid=unix-user,gid=unix-group,username=windows-user,password=windows-pass,domain=domainame 0 0
@xoner
xoner / ChangeExtension.ps1
Created October 15, 2012 08:05
Change the extension of a set of files in powershell (in this gist from .markdown to .md)
foreach ($itFile in ls *.markdown)
{
if ($itFile -match '(.*)\.(\w+)')
{
Write-Host 'Renaming ' $itFile
$destFile = $Matches[1] + '.md'
mv $itFile $destFile
}
}
@xoner
xoner / GenPassword.ps1
Last active October 12, 2015 06:48
Generate passwords in powershell throuht System.Web.Security.Membership
# You must load the System.Web assembly to your powershell session to make this script work.
[Reflection.Assembly]::LoadWithPartialName('System.Web')
function GenPassword
{
Param(
[int] $PasswordLength = 0,
[ValidateSet("low", "medium", "high")]
[string] $PasswordComplexity = "medium"
@xoner
xoner / pshh.ps1
Created November 29, 2012 10:26
Simple function to load putty inside Conemu hosted powershell given a hostname or a saved session name.
function pssh()
{
Param
(
[Parameter(Mandatory=$true)]
[String]
$destinationHost = $null
)
@xoner
xoner / gist:4540740
Last active December 11, 2015 03:49 — forked from lucasfais/gist:1207002
Sublime Text 2 OSX Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt