Skip to content

Instantly share code, notes, and snippets.

View zgramana's full-sized avatar

Zachary Gramana zgramana

View GitHub Profile
void CreateDatabase ()
{
_db = Manager.SharedInstance.GetExistingDatabase (DATABASE_NAME);
if (_db == null)
{
var assembly = Assembly.GetCallingAssembly ();
var resourceName = assembly
.GetManifestResourceNames()
.Where (x => x.EndsWith("couchbase-connect.cblite"))
{
"type": "product-recommendations",
"product-id": "111",
"recommendations": [
{
"_id": "222",
"name": "Handy Hammer",
"min_price": 3.45,
"currency": "USD",
"quantity": {
@zgramana
zgramana / ssl3_server.py
Last active August 29, 2015 14:08
POODLE test target
# Adapted from http://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/
'''
SimpleSecureHTTPServer.py - simple HTTP server supporting SSL.
- replace fpem with the location of your .pem server file.
- the default port is 443.
usage: python SimpleSecureHTTPServer.py
'''
import socket, os
@zgramana
zgramana / ExampleQueryByG.cs
Last active August 29, 2015 14:06
Query Firstname / Lastname for names starting with G
public void PutNPeople(Database db, int n)
{
var lastNames = new[] { "Gramana", "Johnson", "Hunter", "Carter" };
var firstNames = new[] { "Zack", "Bryan", "Greg", "Wayne" };
for (int i = 0; i < n; i++)
{
var doc = new Dictionary<string, object>
{
{ "firstName", firstNames[i % 4] },
@zgramana
zgramana / bash.sh
Created July 23, 2014 19:31
Use a self-signed certificate in Couchbase Lite for iOS
openssl x509 -outform der -in cert.pem -out cert.der
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=JWR66N
ro.build.display.id=JWR66N
ro.build.version.incremental=711294
ro.build.version.sdk=18
ro.build.version.codename=REL
ro.build.version.release=4.3
ro.build.date=Sat Jun 15 19:53:50 UTC 2013
ro.build.date.utc=1371326030
@zgramana
zgramana / replace-headers.sh
Created February 13, 2014 02:10
Shell script that replaces an optional old header with a new header, which includes the name of the file containing the header.
#!/bin/bash
# Replace the old headers with the new ones.
# Find all csharp files, recursively.
# If it has an old header, remove it.
# Then insert the new header which includes
# the current file's name.
for file in $(find . -type f -name '*.cs'); do
fileName=${file##*/} # Split on the path char, and take the last segment.
headerStart='1i \
@zgramana
zgramana / connect.sh
Last active January 4, 2016 20:19
Test Node + Express server.
curl http://localhost:3000/socket.io/1
@zgramana
zgramana / gist:8362306
Created January 10, 2014 20:49
Selected MonoDevelope/Xamarin Studio ProjectTypeGuids.
<DotNetProjectSubtype
guid="{e613f3a2-fe9c-494f-b74e-f63bcb86fea6}"
type="MonoDevelop.IPhone.IPhoneProject"
migrationHandler="MonoDevelop.IPhone.IPhoneProjectMigrationHandler" />
<DotNetProjectSubtype
guid="{6bc8ed88-2882-458c-8e55-dfd12b67127b}"
type="MonoDevelop.IPhone.IPhoneProject" />
<DotNetProjectSubtype
guid="{f5b4f3bc-b597-4e2b-b552-ef5d8a32436f}"
type="MonoDevelop.IPhone.IPhoneBindingProject"
If you want to debug your Xamarin app using LLDB to get a backtrace, then do the following:
1) Clone https://github.com/zgramana/ios-deploy (or download https://www.dropbox.com/s/8fl1t1qc5fdg5tn/ios-deploy)
2) Run `make` inside that folder.
3) Run `./ios-deploy -d -b path/to/bin/iPhone/Debug/MyFoo.app`
This will install your app and start it will lldb attached.
From the lldb prompt: