Skip to content

Instantly share code, notes, and snippets.

View kevinmcmahon's full-sized avatar

Kevin McMahon kevinmcmahon

View GitHub Profile
@kevinmcmahon
kevinmcmahon / gist:1584983
Created January 9, 2012 21:16
PostgreSQL copy command for importing CSV data.
\copy landmarks(name,address,date_built,architect,landmark,latitude,longitude) FROM '/local/path/to/Individual_Landmarks.csv' DELIMITERS ',' CSV HEADER;
@kevinmcmahon
kevinmcmahon / gist:1584721
Last active December 15, 2019 23:08
Create a PostgreSQL table to hold the Individual_Landmarks.csv data
CREATE TABLE landmarks
(
gid serial NOT NULL,
name character varying(50),
address character varying(50),
date_built character varying(10),
architect character varying(50),
landmark character varying(10),
latitude double precision,
longitude double precision,
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
@kevinmcmahon
kevinmcmahon / gist:1014915
Created June 8, 2011 17:48
C# IfModifiedSince
public static void Main (string[] args)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://example.com/file.xml");
// Note that previousValue is a DateTime now!
request.IfModifiedSince = DateTime.Now;
try
{
using (WebResponse response = request.GetResponse())
@kevinmcmahon
kevinmcmahon / gist:1005881
Created June 3, 2011 04:42
Android If-Modified-Since
HttpClient httpClient = new DefaultHttpClient();
HttpHead httpHead = new HttpHead(accountUrl);
long date = cachedFile.lastModified();
String lastModified = DateUtils.formatDate(new Date(date), "EEE, d MMM yyyy HH:mm:ss 'GMT'");
httpHead.addHeader("If-Modified-Since", lastModified);
HttpResponse response = httpClient.execute(httpHead);
int statusCode = response.getStatusLine().getStatusCode();
return statusCode != HttpStatus.SC_NOT_MODIFIED;
@kevinmcmahon
kevinmcmahon / gist:957507
Created May 5, 2011 17:45
rack-jekyll issue?
2011-05-05T17:44:15+00:00 app[web.1]: Configuration from /app/_config.yml
2011-05-05T17:44:16+00:00 app[web.1]: /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:243:in `mkdir': Permission denied - /app/_site (Errno::EACCES)
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:243:in `fu_mkdir'
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:217:in `mkdir_p'
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:215:in `reverse_each'
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:215:in `mkdir_p'
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:201:in `each'
2011-05-05T17:44:16+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:201:in `mkdir_p'
2011-05-05T17:44:16+00:00 app[web.1]: from /app/.gems/gems/jekyll-0.10.0/lib/jekyll/post.rb:198:in `write'
2011-05-05T17:44:16+00:00 app[web.1]: from /app/.gems/gems/jekyll-0.10.0/lib/jekyll/
@kevinmcmahon
kevinmcmahon / gist:949755
Created April 30, 2011 15:36
Example showing a non-Thumb static iOS library using otool
otool -tv libfacebook_ios_sdk.a
Archive : libfacebook_ios_sdk.a (architecture armv6)
libfacebook_ios_sdk.a(FBRequest.o) (architecture armv6):
(__TEXT,__text) section
-[FBRequest loading]:
00000000 e59f3010 ldr r3, [pc, #16] ; 0x18
00000004 e79f3003 ldr r3, [pc, r3]
00000008 e7900003 ldr r0, [r0, r3]
@kevinmcmahon
kevinmcmahon / gist:938870
Created April 23, 2011 18:51
Code Camp Session Data XML
<sessions version="1">
<category name="Regular Sessions">
<session>
<title>let cygwin take you to a whole gnu world</title>
<speaker>
<name>Ryan Gerry</name>
<company></company>
<bio>A software craftsman with eight years of professional experience.</bio>
<headshot></headshot>
</speaker>
_dropnetClient.GetFile(selected.Path, (RestSharp.RestResponse r) => {
try {
using(FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
using(BinaryWriter bw = new BinaryWriter(fs))
{
bw.Write(r.RawBytes);
}
}
@kevinmcmahon
kevinmcmahon / gist:877696
Created March 19, 2011 18:38
MonoTouch Binding Help
NOTE: This is pulled from an email exchange and hopefully will be polished up and published as a blog post at http://blog.kevfoo.com but until then I'll just dump it here in a gist. If you have any questions leave comments or ask them in #monotouch on IRC. (I am klmcmahon on IRC)
<Begin Excerpt>
I'm going to do a quick brain dump and attach some code for a generator that was passed around on the #monotouch IRC channel. This is extremely raw and stream of conscious but probably what will become the blog post when it gets fleshed out better.
Step 1: You _HAVE_ to have a static library that has been compiled without THUMB code being generated. (NOTE: I haven't upgraded to iOS 4.3 tools and XCode yet but apparently this isn't the case anymore since Apple appears to have fixed the bug) There is a linker bug that Apple introduced and has yet to fix that causes problems at compile time when trying to link in static libraries with THUMB enabled. You can run a command via the shell to check the dumped output (here