Skip to content

Instantly share code, notes, and snippets.

@vgvinay2
vgvinay2 / install-pulse.sh
Created December 18, 2017 16:28 — forked from tafarij/install-pulse.sh
Install Pulse Secure on Ubuntu 16.04
# https://vt4help.service-now.com/kb_view_customer.do?sysparm_article=KB0010740#linux
wget https://secure.nis.vt.edu/resources/downloads/pulse-8.2R5.i386.deb
sudo dpkg –i pulse-8.2R5.i386.deb
/usr/local/pulse/PulseClient.sh install_dependency_packages
@vgvinay2
vgvinay2 / post_xml.rb
Created December 27, 2016 10:39 — forked from mattriley/post_xml.rb
Ruby HTTP POST request containing XML content
require 'net/http'
def post_xml url_string, xml_string
uri = URI.parse url_string
request = Net::HTTP::Post.new uri.path
request.body = xml_string
request.content_type = 'text/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
response.body
end
@vgvinay2
vgvinay2 / soundex.js
Created November 21, 2016 09:19 — forked from shawndumas/soundex.js
Soundex in JavaScript
var soundex = function (s) {
var a = s.toLowerCase().split(''),
f = a.shift(),
r = '',
codes = {
a: '', e: '', i: '', o: '', u: '',
b: 1, f: 1, p: 1, v: 1,
c: 2, g: 2, j: 2, k: 2, q: 2, s: 2, x: 2, z: 2,
d: 3, t: 3,
l: 4,
@vgvinay2
vgvinay2 / security_algorithms.md
Created August 22, 2016 15:46 — forked from jamesyang124/security_algorithms.md
security algorithms for refactoring.
@vgvinay2
vgvinay2 / deploy.rb
Created April 10, 2016 18:12 — forked from markoa/deploy.rb
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@vgvinay2
vgvinay2 / gist:36ab54d95472ef0b057b
Created January 29, 2016 17:40 — forked from bkimble/gist:1365005
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@vgvinay2
vgvinay2 / SQL-Movie-Rating.sql
Created January 27, 2016 11:10
My answers to SQL exercises for db-class.org /Part 1/
/* Delete the tables if they already exist */
drop table if exists Movie;
drop table if exists Reviewer;
drop table if exists Rating;
/* Create the schema for our tables */
create table Movie(mID int, title text, year int, director text);
create table Reviewer(rID int, name text);
create table Rating(rID int, mID int, stars int, ratingDate date);
@vgvinay2
vgvinay2 / facebook.coffee
Created October 9, 2015 15:15 — forked from mupkoo/facebook.coffee
Facebook Like snippet for Turbolinks
class @Facebook
rootElement = null
eventsBound = false
@load: ->
unless $('#fb-root').size() > 0
initialRoot = $('<div>').attr('id', 'fb-root')
$('body').prepend initialRoot
//Constructor
var Person = function (name, age){
//private properties
var priv = {};
//Public properties
this.name = name;
this.age = age;
//Public methods

Ruby language

General

[extend ]

The extend method works similar to include, but unlike include, you can use it to extend any object by including methods and constants from a module. It can add class level methods - something that include can't do.

module Foo