Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / Test-ServerConnectivity.ps1
Created October 27, 2014 00:11
Test a server for connectivity without PING
# From http://blogs.technet.com/b/heyscriptingguy/archive/2014/10/25/powertip-test-connectivity-to-remote-servers-without-ping.aspx
# Test a server for connectivity without PING
's1','s2' | % {Test-Wsman $_}
#!/bin/sh
DEBUG=""
DATE=$(date +%Y-%m-%d)
HOSTNAME=`/bin/hostname`
AMINAME="$DATE-$HOSTNAME-AMI"
AMIDESC="$HOSTNAME backup to AMI on $DATE"
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"
test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id'
@dziemborowicz
dziemborowicz / Remove-MsgAttachment.ps1
Last active December 30, 2021 18:38
PowerShell cmdlet for removing attachments from *.msg files
function Remove-MsgAttachment
{
[CmdletBinding()]
Param
(
[Parameter(ParameterSetName="Path", Position=0, Mandatory=$True)]
[String]$Path,
[Parameter(ParameterSetName="LiteralPath", Mandatory=$True)]
GIT_VERSION=`git --version | awk '{print $3}'`
URL="https://raw.github.com/git/git/v$GIT_VERSION/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion for git version: $GIT_VERSION..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
@stevobengtson
stevobengtson / brew_cleanup.sh
Created May 15, 2014 22:16
Brew clean up script
#!/bin/bash
#
# Clear out old, inactive versions of software
# installed by Homebrew.
# Created by Colin and listed on http://www.nonsenseby.me/blog/2014/01/12/remove-old-versions-in-homebrew/
#
set -o noglob
# Some brew settings.
readonly BREW_CMD=$( which brew )
readonly BREW_AWK="/tmp/brew.$$.awk"
@Visgean
Visgean / wall_scrap.py
Created May 15, 2014 22:07
Scrapping stories from Facebook wall
API_RECURSION_LIMIT = 5
def get_stories(object_id):
token = facebook.get_app_access_token(APP_ID, APP_SECRET)
graph = facebook.GraphAPI(token)
def get_interesting_stories(until=None, since=None, recursion_level=0):
"""Recursive function that digs all the interesting stories till the recursion level is reached"""
api_parameters = {
'id': '{page_id}/feed'.format(page_id=object_id),
SRV
_minecraft._tcp
Service:_minecraft
Protocol:_tcp
Name:@
Priority:0
Weight:0
Port:25565
Target:livecraft.us
Automatic
@goyuninfo
goyuninfo / mysql.example.py
Created May 15, 2014 22:01
Example of Python Script to deal with MySQL
#!/usr/bin/python
import MySQLdb
conn = MySQLdb.connect (host = "host",
user = "us",
passwd = "pass",
db = "yourDB")
cursor = conn.cursor (MySQLdb.cursors.DictCursor )
cursor.execute ("SELECT * from yourTable")