Skip to content

Instantly share code, notes, and snippets.

View mchirico's full-sized avatar
💭
Kubernetes... API Server Development

Mike Chirico mchirico

💭
Kubernetes... API Server Development
View GitHub Profile
@mchirico
mchirico / equipFromMac.sh
Created March 17, 2014 00:19
Getting MAC address to tell you the manufacture of NIC card.
# Step 1.
# Download the ieee list of Organizationally Unique Identifier (OUI)
# for all MAC addresses.
#
# wget http://standards.ieee.org/develop/regauth/oui/oui.txt
# Step 2.
# Run the following script to see the hardware on your system.
arp -a|awk '{print $4}'|tr '[:lower:]' '[:upper:]'|awk 'BEGIN{FS=":"}{cmd=sprintf("grep \"%s-%s-%s\" oui.txt",$1,$2,$3); cmd|getline D; close(cmd); print D}'
@mchirico
mchirico / mapSimple.go
Created March 22, 2014 00:06
Simple map in golang
package main
//http://play.golang.org/p/0KdITlFYrV
import "fmt"
func main() {
H := make(map[string]int)
for i := 0; i < 3; i++ {
s := fmt.Sprintf("one%d", i)
H[s] = H[s] + 1
@mchirico
mchirico / Mjcon.java
Created June 26, 2014 13:45
Java example working with tools
package dev.sysadmin;
import java.lang.management.*;
import java.io.*;
import java.util.*;
import javax.management.*;
import javax.management.remote.*;
import com.sun.tools.attach.*;
import javax.management.openmbean.CompositeData;
public class Mjcon {
@mchirico
mchirico / MyUIV.swift
Created August 29, 2014 15:30
Simple UIView to draw lines and squares
import Foundation
import UIKit
class MyUIV:UIView {
//ddrawRect:(CGRect)rect
override func drawRect(rect: CGRect) {
@mchirico
mchirico / UITableViewDSExampl.swift
Last active August 29, 2015 14:06
UITableViewDataSource for Xcode 6b7. They changed a few things
//
// MainViewController.swift
// AddEvents
//
// Created by Michael Chirico on 9/6/14.
// Copyright (c) 2014 Michael Chirico. All rights reserved.
//
import UIKit
@mchirico
mchirico / gist:5810f53df77fddec68cd
Created September 7, 2014 14:02
Working with UIViewController, UITableViewDataSource
//
// MainViewController.swift
// AddEvents
//
// Created by Michael Chirico on 9/6/14.
// Copyright (c) 2014 Michael Chirico. All rights reserved.
//
import UIKit
@mchirico
mchirico / unsolvedAnyObject.swift
Created September 21, 2014 23:45
Unsolved Swift Problem ... can't figure this out...
/*
someObjects is [AnyObject!], but I want to
define it again as Array of Dictionary<String:String>
*/
// Starts out like this
let someObjects: [AnyObject!] = [
["a one":"1", "a two":"2","a three":"3"],
["b one":"1", "b two":"2","b three":"3"]]
@mchirico
mchirico / pub.sh
Created November 30, 2014 15:49
Rsync public bash script
#!/bin/bash
#scp -r /Users/mchirico/Dropbox/webDev/Publish/* mAW:/var/www/html
cp /Users/mchirico/How_to_Linux_and_Open_Source.txt /Users/mchirico/Dropbox/webDev/Publish/
rsync -Lae ssh /Users/mchirico/Dropbox/webDev/Publish/ mAW:/var/www/html
rm -rf /Users/mchirico/Dropbox/webDev/Publish/*
cd /Users/mchirico/Dropbox/webDev/WebSiteDialog
git add Mike\ Chirico\'s\ Blog.rw6/
git commit -a -m 'Update after pub'
@mchirico
mchirico / gist:b6e7ca61fdbc3b870b98
Created November 30, 2014 15:54
Keeping files in sync between servers
TIP 22:
Keeping Files in Sync Between Servers.
The remote computer is "192.168.1.171" and has the account "donkey". You want
to "keep in sync" the files under "/home/cu2000/Logs" on the remote computer
with files on "/home/chirico/dev/MEDIA_Server" on the local computer.
$ rsync -Lae ssh donkey@192.168.1.171:/home/cu2000/Logs /home/chirico/dev/MEDIA_Server
@mchirico
mchirico / example Deny rules
Created December 28, 2014 13:33
Example Deny rules for
<Directory "/var/www/html">
order allow,deny
allow from all
deny from 1.0.1.0/24
deny from 1.0.128.0/17
deny from 1.0.2.0/23
</Directory>