Skip to content

Instantly share code, notes, and snippets.

@kelchm
kelchm / gist:4753037
Created February 11, 2013 06:55
Fix missing border for .MToolControl.stretch in e4_default_mac.css.
.MToolControl.stretch {
visibility: hidden;
}
The operation couldn’t be completed. (kCFStreamErrorDomainSSL error -9806.)
@kelchm
kelchm / logtruncate
Last active December 16, 2015 00:19
Simple bash script to truncate lines from the beginning of a file. Useful for dealing with large log files.
#!/bin/bash
function log_output {
logger -p daemon.warning $1
echo $1
}
function truncate_start {
FILE_PATH="$1"
SAVE_LINES=$2
F = new int[n][w];
// Initialize first row and first column to zero
for(int i = 0; i<n; i++)
{
F[i][0] = 0;
}
for(int i = 0; i<w; i++)
{
F[0][i] = 0;
@kelchm
kelchm / region.csv
Created July 8, 2013 21:15
This is a quick example of one way to grab the full region name based on country and region code provided by the php geoip module using MaxMind's region.csv for the data.
AD 02 Canillo
AD 03 Encamp
AD 04 La Massana
AD 05 Ordino
AD 06 Sant Julia de Loria
AD 07 Andorra la Vella
AD 08 Escaldes-Engordany
AE 01 Abu Dhabi
AE 02 Ajman
AE 03 Dubai
+----+--------------------------------------------+
| id | breakline |
+----+--------------------------------------------+
| 1 | > -----Original Message----- |
| 2 | ----- Original Message ----- |
| 3 | -----Original Message----- |
| 4 | <!-- Break Line --> |
| 5 | ====== Please reply above this line ====== |
| 6 | _____ |
| 7 | > |
11/13/13 10:28:31.000 PM kernel[0]: Longterm timer threshold: 1000 ms
11/13/13 10:28:31.000 PM kernel[0]: PMAP: PCID enabled
11/13/13 10:28:31.000 PM kernel[0]: PMAP: Supervisor Mode Execute Protection enabled
11/13/13 10:28:31.000 PM kernel[0]: Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64
11/13/13 10:28:31.000 PM kernel[0]: vm_page_bootstrap: 8147487 free pages and 208353 wired pages
11/13/13 10:28:31.000 PM kernel[0]: kext submap [0xffffff7f807a5000 - 0xffffff8000000000], kernel text [0xffffff8000200000 - 0xffffff80007a5000]
11/13/13 10:28:31.000 PM kernel[0]: zone leak detection enabled
11/13/13 10:28:31.000 PM kernel[0]: "vm_compressor_mode" is 4
11/13/13 10:28:31.000 PM kernel[0]: standard timeslicing quantum is 10000 us
11/13/13 10:28:31.000 PM kernel[0]: standard background quantum is 2500 us
@kelchm
kelchm / config.plist
Created November 24, 2013 14:46
Current Clover EFI configuration.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ACPI</key>
<dict>
<key>DSDT</key>
<dict>
<key>Debug</key>
<false/>
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
@kelchm
kelchm / cables-report.php
Created December 30, 2013 22:40
A simple report for racktables which displays all named cables and provides links to the relevant ports.
<?php
include ('inc/init.php');
$tabhandler['reports']['cableid'] = 'renderCableIdReport'; // register a report rendering function
$tab['reports']['cableid'] = 'Cable IDs'; // title of the report tab
function renderCableIdReport()
{
global $dbxlink;
$sql = "SELECT Link.*, porta.id as porta_id, porta.name as porta_name, objecta.id as objecta_id, objecta.name as objecta_name, portb.id as portb_id, portb.name as portb_name, objectb.id as objectb_id, objectb.name as objectb_name