Skip to content

Instantly share code, notes, and snippets.

@victorbstan
victorbstan / .vimrc
Created September 22, 2011 17:01
My .vimrc setup
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=700
@wolever
wolever / gevent_issues.md
Created May 28, 2012 18:24
Some issues we've encountered with gevent

Below are some issues we encountered during our first real deployment of gevent. It is being used on one host to communicate over ethernet (ie, using raw ethernet packets) with approximately 700 PIC32 microprocessors, and it is used for communication between all of the services we have built (approximately 15 unique services running on two hosts).

  • The majority of the issues we faced were caused by a particular service which communicates with a child process over stdin/stdout. Not all of the issues were gevent specific (for example, when the child wasn't properly selecting on stdout, the kernel was silently dropping data when its internal buffer filled up, even though fwrite reported that the data had been written).
  • We are using gevent-0.13.7 with libevent-2.0.x. I would like to be using gevent-1.0, but it was causing some issues (I don't recall exactly what they were) on OS X, so we rolled back to 0.13.7.
  • libevent-1.4.13-stable (packages with Debian stable 6.0.4) would, under moderate l
@wolever
wolever / media_link.py
Created July 3, 2012 20:09
Links to Django media files, including mtime for cache busting
@shazow
shazow / gist:4227021
Created December 6, 2012 18:48
Closure scopes in JavaScript.
(function() {
// This is a new closure. If things that happen here don't have side-effects on outside scope,
// then whatever happens here will not be visible outside of it.
(function() {
// You can make closures inside of closure (inside of closures). Wee.
})();
})();
@kayzhu
kayzhu / csrf.js
Last active September 27, 2016 10:11
Send POST request in Angular.js to a CSRF-protected Django view
<script type="text/javascript" src="/angular/angular.js"></script>
<script type="text/javascript" src="/angular/angular-cookies.min.js"></script>
// app.js
// inject ngCookies to your app named 'myApp'.
angular.module('myApp', ['ngCookies']);
// controller.js
function MyCtrl($scope, $http, $cookies) {
@aaronblohowiak
aaronblohowiak / gist:3932768
Created October 22, 2012 17:23
RedisConf Notes Part I
Redisconf Notes:
"We will begin this morning with a performance"
"Is this a key store..." Bohemian Rhapsody Key/Value Store ballad. Epic Win!
"Any way the data flows doesn't really matter to me... flushdb..."
"Lua killed a db by writing after calling a nondeterministic function..."
"Got to leave SQL behind and face the truth..."
"Redis, I don't want to join, sometimes I wish I'd never described a query..."
"The ZSET has some data set aside for me, for me, for MEEEEEEE"
@jaseg
jaseg / gist:3334991
Created August 12, 2012 22:32
Password manager without a password manager

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

As pointed out here: http://news.ycombinator.com/item?id=4374888 this method is broken.

Usage

@nodesocket
nodesocket / bootstrap.flatten.css
Last active April 1, 2021 23:37
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
@guyromm
guyromm / rps.py
Created March 7, 2011 17:08
socket.io flask route
@app.route('/socket.io/websocket')
def socketio():
s = request.environ['socketio']
if s.on_connect():
#print 'CONNECTED', locals()
#s.send({'buffer': buffer})
#s.broadcast({'announcement': s.session.session_id + ' connected'})
pass
game_id=None;game=None;cook=None;i_am='spectator';rdsub = redis.Redis('localhost')
while True:
@lucasw
lucasw / usb_cameras_with_ros.md
Last active February 21, 2023 23:24
USB/V4L/UVC Cameras with ROS

USB 'web' cameras vs. ethernet and network cameras

Cost and feature/performance trade-offs

Built-in laptop camera

$ lsusb
Bus 002 Device 004: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications Processor
Bus 002 Device 002: ID 8087:8000 Intel Corp.