Skip to content

Instantly share code, notes, and snippets.

View seancallaway's full-sized avatar

Sean Callaway seancallaway

View GitHub Profile
@seancallaway
seancallaway / VS2010_gitignore
Created August 26, 2013 23:12
My Visual Studio 2010 .gitignore File
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
@seancallaway
seancallaway / gist:8885137
Created February 8, 2014 15:09
Schwerdtfeger's Variation of Kraitchik's Algorithm Without Using Lookup Tables
enum day_of_week_t { SUN, MON, TUES, WED, THURS, FRI, SAT };
day_of_week_t calcDayOfWeek(unsigned int day, unsigned int month, unsigned int year)
{
int Y = 0, y = 0, c = 0, m = 0, d = 0, w = 0;
// Check for vaild arguments
year = year % 10000;
if (month < 1 || month > 12)
server {
listen 80;
listen [::]:80;
root <PATH_TO_DOCUMENT_ROOL>/html;
index index.php index.html index.htm;
server_name <HOSTNAME>.<DOMAIN_NAME>;
location / {
server {
listen 80 ;
listen [::]:80;
server_name <HOSTNAME>.<DOMAINNAME>;
# Force redirection to secure site
return 301 https://$server_name$request_uri;
}
server {
listen 80;
listen [::]:80;
root <PATH_TO_DOCUMENT_ROOT>/html;
index index.php index.html index.htm;
server_name www.<DOMAIN_NAME> <DOMAIN_NAME>;
location / {
@seancallaway
seancallaway / convert.py
Created February 4, 2016 17:18
Converts a string into it's hexadecimal representation. Intended for BGP TCP MD5 passwords in BIRD on OpenBSD.
#!/usr/bin/env python
import sys, binascii
y = "your_password";
# If they didn't provide a password on the command-line, use the hard coded one.
if len(sys.argv) > 1:
y = str(sys.argv[1])
@seancallaway
seancallaway / mergetiff.cs
Created April 30, 2016 13:30
Code For Merging TIFFs in C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
private static void MergeTiffs(List<Bitmap> bmps, string filename)
{
// Save first bitmap to memory as TIFF
@seancallaway
seancallaway / jar-launcher.desktop
Created May 24, 2017 19:51
Desktop entry for launching JAR files.
# /usr/share/applications/jar-launcher.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=java -jar %f
Icon=java
Name=jar-launcher
Comment=Launch a jar file
@seancallaway
seancallaway / site.conf
Created November 30, 2017 20:09
Nginx HTTPS Virtual Host file
server {
listen 80;
server_name <hostname>;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name <hostname>;
@seancallaway
seancallaway / install_jenkins.yml
Created March 3, 2018 18:45
Ansible Playbook for Installing Jenkins on Centos 7
---
- hosts: jenkins
roles:
- role: ansiblebit.oracle-java
oracle_java_set_as_default: yes
tasks:
- name: Ensure Jenkins Repository is Installed
yum_repository:
name: jenkins
state: present