Skip to content

Instantly share code, notes, and snippets.

@anujb
anujb / GIF-Screencast-OSX.md
Created May 1, 2019 19:01 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

async Task CompileModelAsync()
{
//Define remote URL
var model_remote_url = "";
var model_name = "FruitModel";
var model_file_extension = "mlodel";
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string model_path = Path.Combine(path, $"{model_name + model_file_extension}");
public class GzipWebClient : WebClient
{
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address);
if(request is HttpWebRequest)
{
((HttpWebRequest)request).AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
}
Logger.Info("Sending analytics request to Segment.io ..", props);
var start = DateTime.Now;
HttpResponseMessage response = null;
try {
//breakpoint hit
response = _client.SendAsync(request).Result;
public class EventArgs<T> : EventArgs
{
public T Data { get; set; }
public EventArgs (T data)
{
Data = data;
}
public static EventArgs<T> From (T data)
@anujb
anujb / gist:5155283
Created March 13, 2013 19:26
ABAddressBook Check
if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0))
{
var status = ABAddressBook.GetAuthorizationStatus();
if (status == ABAuthorizationStatus.Denied || status == ABAuthorizationStatus.Restricted) {
// no address book
} else {
if (this.addressBook == null)
this.addressBook = new ABAddressBook();
if (status == ABAuthorizationStatus.NotDetermined) {
@anujb
anujb / gist:5154227
Created March 13, 2013 17:17
ABAddressBook Create
public static ABAddressBook Create (out NSError error)
{
IntPtr intPtr;
IntPtr value = ABAddressBook.ABAddressBookCreateWithOptions (IntPtr.Zero, out intPtr);
ABAddressBook result;
if (value == IntPtr.Zero)
{
error = new NSError (intPtr);
result = null;
}
@anujb
anujb / gist:5154221
Created March 13, 2013 17:16
ABAddressBook.Create
public static ABAddressBook Create (out NSError error)
{
IntPtr intPtr;
IntPtr value = ABAddressBook.ABAddressBookCreateWithOptions (IntPtr.Zero, out intPtr);
ABAddressBook result;
if (value == IntPtr.Zero)
{
error = new NSError (intPtr);
result = null;
}
@anujb
anujb / gist:4727142
Last active December 12, 2015 06:09
Task Threading and Memory Management
public class MyViewController : UIViewController {
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
for (int i = 0; i < Int32.MaxValue; i++) {
DoStuffAsync();
}
}
@anujb
anujb / gist:4528263
Created January 14, 2013 06:54
Gorilla json-rpc sample
package main
import (
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
"net/http"
)
type HelloArgs struct {
Who string