Skip to content

Instantly share code, notes, and snippets.

Avatar
🎿
NOP Sledding

Jameel Haffejee RC1140

🎿
NOP Sledding
View GitHub Profile
View gist:d0008fab2ed0d01859ef
from PyPDF2 import PdfFileWriter, PdfFileReader
input1 = PdfFileReader(open("fileToSplit.pdf", "rb"))
for i in range(input1.numPages):
output = PdfFileWriter()
output.addPage(input1.getPage(i))
outputStream = file('review'+i.__str__()+'.pdf', "wb")
output.write(outputStream)
outputStream.close()
View Encrypted Slider
eval(function(p, a, c, k, e, r) {
e = function(c) {
return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) r[e(c)] = k[c] || e(c);
k = [function(e) {
return r[e]
}];
e = function() {
View Find folders greater than 2 gigs
du -s * |awk '{if ($1/1024 > 2000 ) print $1/1024 " " $2 " " $3 " " $4}'
View Comparing_branched_File
Param($Param1,$Param2)
switch ($Param2)
{
"dev" {$searchPath = "C:\Development\"}
"prod" {$searchPath = "C:\Development\Prod"}
"test" {$searchPath = "C:\Development\Testing"}
default {$searchPath = "C:\Development\"}
}
View wakeonlan
#!/usr/bin/env python
import socket
import struct
def wake_on_lan(macaddress):
""" Switches on remote computers using WOL. """
# Check macaddress format and try to compensate.
if len(macaddress) == 12:
View SendXmppMessage
[Reflection.Assembly]::LoadFile("c:\temp\agsXMPP.dll")
$clientConnection = new-object agsXMPP.XmppClientConnection
$clientConnection.Server = "gmail.com"
$clientConnection.ConnectServer = "talk.google.com"
$clientConnection.Open("EnterYourUserNameHere","EnterYourPasswordHere")
$message = new-object agsXMPP.protocol.client.Message("Who do you want to send the message to ","Errr is this thing on")
$clientConnection.Send($message)
View Uninstall App
$app = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match "Software Name"
}
$app.Uninstall()
View PingNetwork
gwmi -query "select * from win32_pingstatus where Address='192.168.0.1'"
#{1..254 | %{ gwmi -query ("select * from win32_pingstatus where Address='192.168.0."+ $_+ "'") }}
View gist:408624
[string](new-object System.Net.WebClient).DownloadString("http://api.stackoverflow.com/0.8/Users/42069?type=jsontext")
View pcScanner.ps1
([adsisearcher]"objectcategory=computer").findall() | %{([adsi]$_.path).cn + $_.properties.operatingsystemversion}
You can’t perform that action at this time.