Skip to content

Instantly share code, notes, and snippets.

View ryanfitz's full-sized avatar

Ryan Fitzgerald ryanfitz

View GitHub Profile
@ryanfitz
ryanfitz / blocklist_update.sh
Created April 21, 2012 01:07
update transmission blocklists
#!/usr/bin/env sh
killall -9 transmission-daemon
rm -v /mnt/SEA_DISC/torrents/.config/transmission-daemon/blocklists/*
cd /mnt/SEA_DISC/torrents/.config/transmission-daemon/blocklists
ls /mnt/SEA_DISC/torrents/.config/transmission-daemon/blocklists
wget -q -O bt_level1.gz http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz
wget -q -O bt_level2.gz http://list.iblocklist.com/?list=bt_level2&fileformat=p2p&archiveformat=gz
@ryanfitz
ryanfitz / tmux.conf
Created October 20, 2012 05:15
tmux config
set -g prefix C-a
unbind C-b
set -g default-terminal "screen-256color"
set -sg escape-time 1
# window and panes index
set -g base-index 1
setw -g pane-base-index 1
@ryanfitz
ryanfitz / golang-nuts.go
Created December 2, 2012 22:45
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@ryanfitz
ryanfitz / settings.json
Created February 11, 2013 16:38
transmission settings
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/mnt/BIGHUSK/torrents",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-limit-global": 240,
int resultsSize = [self.dataController.products count]; //data is the previous array of data
[self.dataController.products addObjectsFromArray:products];
[self.productsView performBatchUpdates:^{
NSMutableArray *arrayWithIndexPaths = [NSMutableArray array];
for (int i = resultsSize; i < resultsSize + products.count; i++) {
[arrayWithIndexPaths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
}
[self.productsView insertItemsAtIndexPaths:arrayWithIndexPaths];
}
@ryanfitz
ryanfitz / s3_list.swift
Created August 3, 2014 23:48
list s3 buckets using the aws sdk
AWSS3.defaultS3().listBuckets(nil).continueWithBlock {
(task: BFTask!) -> AnyObject! in
let output : AWSS3ListBucketsOutput = task.result() as AWSS3ListBucketsOutput
println("found \(output.buckets.count) buckets")
for bucket in output.buckets as [AWSS3Bucket] {
println("Found bucket \(bucket.name)")
}
return nil
for (NSDictionary *data in responseObject[@"discussions"]) {
NFTDiscussionModel *discussion = [MTLJSONAdapter modelOfClass:[NFTDiscussionModel class]
fromJSONDictionary:data error:nil];
[items addObject:discussion];
}
success([items firstObject]);
@ryanfitz
ryanfitz / sample.js
Created October 12, 2014 14:47
dynamodb document example
var AWS = require("aws-sdk");
var DOC = require("dynamodb-doc");
var path = require('path');
var util = require('util');
var _ = require('lodash');
var async = require('async');
var internals = {};
@ryanfitz
ryanfitz / asyncDataReload.swift
Created March 8, 2015 17:08
example function for reloading sections of ASTableViews
func dataSource(dataSource: ASTableViewDataSource, removedSections: NSIndexSet?, insertedSections: NSIndexSet?, movedSections: [MovedIndex]?) {
dispatch_async(dispatch_get_main_queue()) {
self.tableView.ins_endPullToRefresh()
}
tableView.beginUpdates()
var del = NSMutableIndexSet()
var add = NSMutableIndexSet()
heightForHeaderInSection 0
heightForHeaderInSection 0
heightForHeaderInSection 1
heightForHeaderInSection 1
heightForHeaderInSection 2
heightForHeaderInSection 2
heightForHeaderInSection 3
heightForHeaderInSection 3
heightForHeaderInSection 4
heightForHeaderInSection 4