Skip to main content

Posts

Showing posts with the label Code

Making Google Calendar a responsive embed with Mobile support

Google Calendar is amazing, but the embed code is pretty old.  They haven't updated it in many years. Since everything is Mobile First today, I needed a way to display better on cell phones. The following code does the following: Define a Responsive Cal types so that it uses 100% of the frame Define a DeskContent and a PhoneContent sizes (with a width of 768 being the switch point)  Wrap all of it in the Responsive Call Div so it all resizes automatically Display the Month view of the calendar if it's a desktop resolution Display the Agenda view of the calendar if it's a mobile resolution I've formatted this so that it can be placed inline in your HTML file. The first Embed should be your calendar code set to the Month view. The second Embed should be your calendar code set to the Agenda view.

Oxidized Quickstart

Oxidized is a "RANCID replacement" that has taken on a life of it's own.  Designed to automatically store, compare, and log configuration files from network based equipment. I've never used RANCID, or rConfig, or Sweet, but I wanted to more than a fileshare of all the latest configs of our devices, which is what we were doing. Oxidized the seemed the easiest to setup. Here is how I setup one up from scratch.

Programming DHCP via NETSH

If you need to configure more than two subnets on a Windows 2008 R2 DHCP server (Or all versions later), doing via the GUI is a painful way to do it. Here's a simple cut and paste script that you can run via netsh that will make the subnets much quicker. Launch netsh from the command line, and paste this in: Replace 10.1.0.50 with your DHCP server, and 10.2.0.224 with your Scope's Network (check the subnet mask and the IP range)  Just repeat each section below for each subnet.  I find it easy to just use find and replace to make lots of these. Dhcp Server \\10.1.0.50 add scope 10.2.0.224 255.255.255.224 "Name of the Subnet" "Description of Subnet" Dhcp Server \\10.1.0.50 Scope 10.2.0.224 set state 1 Dhcp Server \\10.1.0.50 Scope 10.2.0.224 set delayoffer 0 # =============================================================== # Start Add Ipranges to the Scope 10.2.0.224, Server 10.1.0.50 # =============================...

WPAD does not resolve in DNS

At work, we're doing a POC (proof of concept) with a web-proxy, specifically Ironport Websecurity Appliance. Like most all proxies, you have to get the traffic from the client to the proxy. It supports transparent traffic redirection, but we're looking at using WPAD instead. However, when I created the WPAD DNS entry, it didn't resolve. C:\>ping wpad Ping request could not find host wpad. Please check the name and try again. C:\>nslookup wpad <DNSServer1> Server: <DNSServer1>.domain.net Address: <IPofDNSServer1> *** <DNSServer1>.domain.net can't find wpad: Non-existent domain This of course, is a big problem. It took a little investigating, but I found the cause. Windows Server 2008 introduced a new feature, called "Global Query Block list", which prevents some arbitrary machine from registering the DNS name of WPAD. This is a good security feature, as it prevents someone from just joining your network, and setting himsel...

Logrotate with Syslog-NG

I wanted to archive my logs that are created with Syslog-NG. But I also wanted to delete them after a while. Syslog-NG does a great job of rotating the logs. There is even a script on the Syslog-NG FAQ that will compress the logs.  My script has now been copied up there. (wohoo) But we have a pretty small Syslog server, and generating 10gigs of logs day fill it up pretty quick. Here's the script I wrote... It's pretty simple to follow: Find all files in the log directory that are not dated today, and that are not .gz, and archive them using gzip. We chose to use Gzip because of the time it takes compared to b2zip. Yes, we can get more space from B2zip, but we usually have to uncompress the file, and B2zip can take 20 minutes to do this. Then, find all files that have not been modified in 14 days, and delete them. Then, find all directories that are empty, and remove them. There is a small logic problem with this script. If you change the modification time of t...

FreeRADIUS PEAP against Active Directory

*Note* This is very old, and very outdated.  I was going to remove it, but according to google, it's still searched very often.  So it stays. *Note* Ok, this is a work in progress. I defiantly have to clean this up, and reorder my thoughts, as well as test my installation. I know there are a few steps I did that I didn't write down This is a Paste from my initial notes. I'll work on it here live. Debian 802.1x PEAP authenticating against Active Directory, using FreeRADIUS First, get OpenSSL Then get libssl Ignore the freeRADIUS package.As of this writing, it’s freeRADIUS 1.0.1-2.Due to license restrictions, it cannot contain the binaries for OpenSSL. We have to use the source. Download the latest release of freeRADIUS.Hopefully when you read this, it will be freeRADIUS 1.1.x, and the rest of the document will be redundant, because these problems will be fixed. As of this writing, the current stable version is 1.0.2 Unzip freeRADIUS Tar –zxvf freeradius-1.0.2....