Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# Example script to start up tunnel with autossh.
#
# This script will tunnel 12345 from the remote host
# to 12345 on the local host.
#
ID=login_here
HOST=destination.host.com
if [ "X$SSH_AUTH_SOCK" = "X" ]; then
@igor-shevchenko
igor-shevchenko / textrank.py
Created June 20, 2013 08:34
TextRank algorithm for text summarization.
from itertools import combinations
from nltk.tokenize import sent_tokenize, RegexpTokenizer
from nltk.stem.snowball import RussianStemmer
import networkx as nx
def similarity(s1, s2):
if not len(s1) or not len(s2):
return 0.0
return len(s1.intersection(s2))/(1.0 * (len(s1) + len(s2)))
@vsajip
vsajip / pyvenvex.py
Last active August 21, 2025 10:07
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013-2020 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
// Debugビルド時のみNSLogを出力する
#ifdef DEBUG
#define DebugNSLog(...); NSLog(__VA_ARGS__);
#else
#define DebugNSLog(...); // NSLog(__VA_ARGS__);
#endif
@cpudney
cpudney / eastersunday.js
Created March 30, 2012 07:11
Easter Sunday
const FIRST_YEAR = 325;
const LAST_YEAR = 3000;
const WIDTH = 960;
const HEIGHT = 500;
const INSETS = {'left': 40,
'right': 10,
'top': 10,
'bottom': 60};
@weierophinney
weierophinney / GuestModule.php
Created December 5, 2011 22:34
Example listener for changing layouts
<?php
namespace Guest;
use Zend\EventManager\StaticEventManager;
class Module
{
public function init()
{
$events = StaticEventManager::getInstance();
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');