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 / Recurively-Find-Owned-By-User.ps1
Last active August 29, 2015 14:13
Recursively looks for files owned by a specified user in a folder and exports them to a csv (excel) spreadsheet.
Get-ChildItem -Force -Recurse -File |
Select *,@{n='Owner';e={(Get-Acl -LiteralPath $_.FullName).Owner}} |
Where {$_.Owner -eq 'DOMAINNAME\username'} | Select FullName, Owner, Length |
Export-Csv Files-User.csv
@xoner
xoner / random_cowsay_fortune
Created May 8, 2015 10:33
Random animals showing random quotes at your terminal
#!/bin/bash
# before running
# apt-get install cowsay fortune
COW_FILES_DIR="/usr/share/cowsay/cows/"
COW_FILE_ORDER=$(( (RANDOM %51) + 2))
RDM_COW_FILE=$(ls -l $COW_FILES_DIR | tail -n +$COW_FILE_ORDER | head -n 1 | awk '{print $9}')
RDM_COW_PATH="$COW_FILES_DIR$RDM_COW_FILE"
@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 / 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 / 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