Skip to content

Instantly share code, notes, and snippets.

@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@captainpete
captainpete / gist:1449044
Created December 8, 2011 22:44
Pyrit benchmark: MacBook Pro 6,2 (15" mid-2010), 2.4GHz Intel Core i5, NVIDIA GeForce GT 330M 256MB
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
Running benchmark (2747.2 PMKs/s)... \
Computed 2747.16 PMKs/s total.
#1: 'OpenCL-Device 'GeForce GT 330M'': 1630.3 PMKs/s (RTT 2.6)
#2: 'CPU-Core (SSE2)': 458.1 PMKs/s (RTT 3.1)
#3: 'CPU-Core (SSE2)': 477.6 PMKs/s (RTT 3.1)
#4: 'CPU-Core (SSE2)': 471.0 PMKs/s (RTT 3.1)
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@guerrerocarlos
guerrerocarlos / main.js
Created September 6, 2012 05:07
loading socket.io using require.js
// Require.js allows us to configure shortcut alias
require.config({
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
shim: {
'socketio': {
exports: 'io'
},
'underscore': {
exports: '_'
@juanje
juanje / gist:3797297
Created September 28, 2012 00:38
Mount apt cache of a Vagrant box in the host to spin up the packages installation

This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.

I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.

def local_cache(basebox_name)
  cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)
  partial_dir = cache_dir.join('partial')
  partial_dir.mkdir unless partial_dir.exist?
 cache_dir
@sarg
sarg / README.md
Last active May 25, 2024 17:04
rk30xx loader image unpacker

Obtaining RK3066 boot ROM.

Here are my steps.

At first, I took a look to RK30xxLoader(L)_V1.18.bin. This file appears in update.img for my device. So, I unpacked update.img using rk29Kitchen.

strings on that file returns nothing interesting, so I assumed the file is crypted

@cenkalti
cenkalti / jenkins-home-git.sh
Last active September 8, 2023 17:19
Backup Jenkins home periodicallly with git.
#!/bin/bash
# Setup
#
# - Create a new Jenkins Job
# - Mark "None" for Source Control Management
# - Select the "Build Periodically" build trigger
# - configure to run as frequently as you like
# - Add a new "Execute Shell" build step
# - Paste the contents of this file as the command
@mweibel
mweibel / passport-mock.js
Last active May 14, 2024 09:32
Mock passport.js with an own strategy
/**
* Author: Michael Weibel <michael.weibel@gmail.com>
* License: MIT
*/
var passport = require('passport')
, StrategyMock = require('./strategy-mock');
module.exports = function(app, options) {
// create your verify function on your own -- should do similar things as
@lovesh
lovesh / admin.py
Last active November 7, 2019 19:37
django-admin register all models
"""
Here models are in different modules and the models.py imports them from different modules like this
from model1 import * # or the name of models you want to import
from model2 import User
or you might write all your models in models.py
"""
@muffinresearch
muffinresearch / gist:7676683
Last active August 18, 2016 22:52
Building simg2img
git clone https://android.googlesource.com/platform/system/extras
cd extras/ext4_utils
git checkout android-4.1.1_r1
gcc -o simg2img -lz sparse_crc32.c simg2img.c
ln -s ${PWD}/simg2img ~/bin/simg2img
# Last step make sure ~/bin is in your $PATH.