This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Welcome to the first installment of emacs-command-a-day. Learning | |
; emacs can be hard as there are many commands and key-bindings that | |
; beginners find difficult. To help you make the transition to "the | |
; best text editor ever", I'll bring you one command each week day, so | |
; you can practice on your own at a reasonable pace. | |
;; Emacs Installation Notes | |
; I assume that you can start emacs. If you have no idea how, (on a | |
; mac or linux system) you should be able to open up a terminal and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""A simple Bloom Filter implementation | |
Calculating optimal filter size: | |
Where: | |
m is: self.bitcount (how many bits in self.filter) | |
n is: the number of expected values added to self.filter | |
k is: the number of hashes being produced | |
(1 - math.exp(-float(k * n) / m)) ** k | |
http://en.wikipedia.org/wiki/Bloom_filter | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def is_3(n): | |
if not n % 3: | |
return True | |
def is_5(n): | |
if not n % 5: | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ADMemberOf { | |
# A fast and accurate way of determining all of the groups | |
# one or more users are part of, especially useful when the groups are nested. | |
# Example: | |
# import-module ActiveDirectory | |
# get-aduser <username> | Get-MemberOf | ft | |
param( | |
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CASServer { | |
<# | |
.SYNOPSIS | |
A Powershell cmdlet to help discover which CAS Server a user has been using | |
(Requires Exchange Management Shell to be running during execution) | |
.PARAMETER Alias | |
The exchange user alias. | |
Will take pipeline input from get-mailbox. | |
.EXAMPLE | |
Get-Mailbox joseph.kern | Get-CASServer | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetPrintersAndPorts { | |
foreach ($printer in $(Get-Printer)) { | |
Get-PrinterPort -Name $printer.PortName | select @{name='Printer';expression={$printer.Name}}, PrinterHostAddress | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getgroups ($object) { | |
### Example: getgroups -object somename.lastname | select name -unique | |
Get-ADPrincipalGroupMembership $object | Foreach { | |
$_ | |
Get-ADPrincipalGroupMembership $_ | |
} | |
} | |
function GetPortsandPrinters { | |
$printers = Get-Printer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# You need PIL <http://www.pythonware.com/products/pil/> to run this script | |
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use | |
# any TTF you have) | |
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com] | |
# License: GPL <http://www.gnu.org/copyleft/gpl.html> | |
from image_utils import ImageText |