Skip to content

Instantly share code, notes, and snippets.

View andymadge's full-sized avatar

Andy Madge andymadge

View GitHub Profile
@boxofrad
boxofrad / gist:8492161
Created January 18, 2014 15:46
Install curl and wget on pfSense
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/
/usr/sbin/pkg_add -r curl
/usr/sbin/pkg_add -r wget
@mkropat
mkropat / getuser.py
Last active July 28, 2024 15:51
Lookup user id and name from the source (read: no environmental variables consulted). Cross-platform compatible (Windows, *nix).
import os
class UserNotFound(Exception): pass
### Windows ###
if os.name == 'nt':
import ctypes
from ctypes import windll, wintypes
class WinError: # [1]
@btm
btm / gist:6700524
Last active July 3, 2025 00:45
Why curl | sudo bash is good: it is simple single line, and uses the same channel that downloading a repository signing key would.

Easy one line Chef installation for all platforms (except windows)

curl https://www.opscode.com/chef/install.sh | sudo bash

That's it. This can be put in any instructions, such as a README or someone's blog, since the logic is in the shell script. Provided you download the script using https, the file has standard levels of authentication and encryption protecting it from manipulation.

This is obviously a shell script, if you're really concerned about the argument that it may contain nefarious activities within, you can easily review it before you run it.

@fase
fase / server.js
Created June 22, 2013 12:42
Node.js Soap & REST Service Calls
var soap = require('soap');
var restClient = require('node-rest-client').Client;
function callSoapService(wsdl, methodName, args)
{
soap.createClient(wsdl, function(err, client) {
client[methodName](args, function(err, result) {
console.log(result);
});
});
@crosbymichael
crosbymichael / Dockerfile
Last active January 8, 2022 13:47
Docker with supervisor
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y openssh-server supervisor
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
RUN mkdir -p /var/run/sshd
@dav3860
dav3860 / gist:5345656
Last active April 27, 2020 11:38
Cisco ASA/PIX config for logstash.
/etc/logstash/logstash.conf :
# We handle the syslog part of the Cisco PIX/ASA messages
grok {
tags => "cisco-fw"
patterns_dir => "/etc/logstash/patterns"
pattern => "^<%{POSINT:syslog_pri}>(?:(%{TIMESTAMP_ISO8601:timestamp8601} |%{CISCOTIMESTAMP:timestamp} ))?%{SYSLOGHOST:logsource}?[ :]+%{GREEDYDATA:syslog_message}"
}
syslog_pri {
tags => "cisco-fw"
@dhiraj
dhiraj / AlbumRatingReset.scpt
Last active April 24, 2018 19:30
This AppleScript may allow you to remove or set the album rating on one or more of your tracks to a value you decide. If you use Smart Playlists based on the track rating field, this may be *the* AppleScript you were looking for. If not, then consider moving on, this is probably not what you were looking for. I've modified the script in this fil…
(*
"Album Rating Reset" for iTunes
written by Doug Adams
[email protected]
v1.0 sept 6 2007
-- initial release
v2.0 mar 6 2013
updated by Dhiraj Gupta (http://www.dhirajgupta.com)
@freekrai
freekrai / DropboxSync.py
Created December 1, 2012 16:34 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
class dropbox_state:
@omz
omz / New from Gist.py
Created November 15, 2012 04:52
New from Gist
### Based on: https://gist.github.com/b0644f5ed1d94bd32805
### This version strips unicode characters from the downloaded script
### to work around the currently limited unicode support of the editor
### module.
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
@omz
omz / dropboxlogin.py
Created November 7, 2012 21:16
dropboxlogin
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'