Skip to content

Instantly share code, notes, and snippets.

@clly
clly / client.py
Created October 22, 2012 16:31
simple TCP Python client and server
from socket import *
HOST = 'localhost'
PORT = 2600
ADDR = (HOST,PORT)
BUFFER = 4096
cli = socket(AF_INET,SOCK_STREAM)
cli.connect((ADDR))
@clly
clly / exThread.py
Created October 22, 2012 20:41
simple Thread example
import threading
theVar = 1
class MyThread(threading.Thread):
def run(self):
global theVar
print 'This is thread ' + str(theVar) + ' speaking'
print 'Hello and goodbye'
theVar = theVar + 1
@clly
clly / acls.ps1
Created November 30, 2012 20:16
Set access control with powershell
# hello.txt is a file in the current directory
# The group everyone will be added to allow it full control
$group = "Everyone"
$control = "FullControl"
$yesno = "Allow"
$acl = get-acl hello.txt
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule $group,$control,$yesno
$acl.SetAccessRule($rule)
@clly
clly / folderacls.ps1
Created November 30, 2012 23:05
Setting ACLs on a folder
$path = "folder"
$propflag = "None"
$inhflag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
$user = "DOMAIN\user"
$acl = get-acl $path
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule $user,"FullControl",$inhflag,$propflag,"Allow"
$acl.SetAccessRule($rule)
$acl | Set-Acl $path
@clly
clly / randpass.ps1
Created December 11, 2012 00:11
Random Passwords
$rand = New-Object System.Random
1..10 | ForEach {$pass = $pass + [char]$rand.next(33,122)}
@clly
clly / bonding.md
Created January 10, 2013 17:53
Creating bonding interfaces in Linux

#Creating Bonding interfaces on Linux

##Configuration Files

###/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none ONBOOT=yes #settings for bond MASTER=bond0

import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
@clly
clly / webtest.py
Last active December 19, 2015 09:59
#!/usr/bin/python
import argparse, urllib2, threading
parser = argparse.ArgumentParser(description="Threaded Web Stress Tester")
parser.add_argument('-c', '--count',
action="store",
dest="count",
default=1000,
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/share/sublime-text-2/sublime_text
Icon=/usr/local/share/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@clly
clly / gist:7dac181f85c12fbd9b7d
Created January 24, 2015 00:25
Cassandra healthcheck
// Author: Connor Kelly
import (
"fmt"
"log"
"github.com/gocql/gocql"
)
func main() {
cluster := gocql.NewCluster("127.0.0.1")