This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sinatra" | |
require 'json' | |
require "oauth" | |
require "oauth/consumer" | |
require 'gmail_xoauth' | |
enable :sessions | |
before do | |
session[:oauth] ||= {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (list-sum l k) | |
(if (null? l) | |
(k 0) | |
(list-sum (cdr l) | |
(lambda (s) (k (+ s (car l))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
± $ rails s 100 on-line | |
=> Booting WEBrick | |
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000 | |
=> Call with -d to detach | |
=> Ctrl-C to shutdown server | |
Exiting | |
/home/rahul/projects/fat_free_crm/lib/fat_free_crm.rb:42:in `<top (required)>': uninitialized constant Rails::Plugin::Loader (NameError) | |
from /home/rahul/projects/fat_free_crm/config/initializers/fat_free_crm.rb:1:in `<top (required)>' | |
from /var/lib/gems/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>' | |
from /var/lib/gems/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:200:in `each' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function Send_to_Screen(text) | |
if !exists("g:screen_sessionname") || !exists("g:screen_windowname") | |
call Screen_Vars() | |
end | |
let s:foo_text = substitute(a:text, '\n\s*\n\+', '\n', 'g') . "\n" | |
echo system("screen -S " . g:screen_sessionname . " -p " . g:screen_windowname . " -X stuff '" . substitute(s:foo_text, "'", "'\\\\''", 'g') . "'") | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -O | |
""" | |
Copies file/folders over scp. Caches password/passphrases. | |
""" | |
import getpass | |
import pexpect | |
import sys | |
from optparse import OptionParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tcp = require("tcp"); | |
var server = tcp.createServer(function (socket) { | |
var client; | |
socket.addListener("connect", function () { | |
client = tcp.createConnection(22); | |
client.addListener("receive", function (data) { | |
socket.send(data); | |
}); | |
client.addListener("eof", function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int get_max_range(int a[], int n, int *start, int *end) | |
{ | |
int temp_sum = 0, sum = 0, found = -1; | |
int i, j; | |
for (i = 0; i < n - 1; i++) { | |
temp_sum = a[i]; | |
*start = i; | |
for (j = i;j < n; j++) { | |
temp_sum = a[j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int missing(int a[], int n) { | |
double num = n + 1; | |
double ideal_sum = (num * (num + 1)) / 2; | |
int sum = 0; | |
int i; | |
for (i = 0; i < n; i++) { | |
sum += a[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int duplicate(int a[], int n) | |
{ | |
int sum = 0, num = n - 1; | |
doulbe ideal_sum = (num * (num + 1)) / 2; | |
int i; | |
for (i = 0; i < n; i++) { | |
sum += a[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
{ | |
private String name; | |
public Person(String name) { | |
this.name = name; | |
} | |
public Person() { | |
} |