Skip to content

Instantly share code, notes, and snippets.

@pandurang90
pandurang90 / openssl.cnf
Last active October 31, 2022 14:30
configure openssl.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@pandurang90
pandurang90 / CDR postgres with index
Created January 11, 2018 08:55
CDR postgres with index
--Start Time--Time Elapsed--CDR query time(ms)--Events read per Interval--Events Read--Events Processed--Events Sent--CPU Usage--Load Average--
--01/11/18 07:15:50--61--248--24--24--24--23--63.48--0.46 0.15 0.09 4/190 23586
--
^C
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ ^C
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ tail -f tmp/benchmark_2018_01_11_07_1
benchmark_2018_01_11_07_14_49.txt benchmark_2018_01_11_07_17_59.txt
deploy@policy-router-test-server-3:/srv/apps/policy_router/current$ tail -f tmp/benchmark_2018_01_11_07_17_59.txt
--Start Time--Time Elapsed--CDR query time(ms)--Events read per Interval--Events Read--Events Processed--Events Sent--CPU Usage--Load Average--
--01/11/18 07:19:00--61--5018--1846--1846--1846--1845--34.6--1.00 0.52 0.25 2/194 23882
@pandurang90
pandurang90 / chat.html.erb
Last active March 21, 2017 03:01
opentok.js
<%= form_tag '#', class: 'chat_form' do %>
<%= text_field_tag ‘message’, id: ‘chat_msg’%>
<%= submit_tag ‘send’%>
<% end %>
<script src='//static.opentok.com/v2/js/opentok.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
var apiKey = <%= OPENTOK_API_KEY %>
// use same session_id and token that we have generated above.
@pandurang90
pandurang90 / chats_controller.rb
Last active March 21, 2017 02:59
opentok session creation
class ChatsController < ApplicationController
def chat
opentok = OpenTok::OpenTok.new OPENTOK_API_KEY, OPENTOK_SECRET_KEY
@session = opentok.create_session
@session_id = @session.session_id
# generate opentok token
@token = session.generate_token
end
end
@pandurang90
pandurang90 / _service.md
Created January 25, 2016 09:12 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@pandurang90
pandurang90 / netcat.scpt
Last active January 3, 2016 23:58
applescript to transfer file using netcat
tell application "SystemUIServer"
set actionSelected to the button returned of (display dialog "What you want to do?" buttons {"Send file", "Receive file"} default button 2)
if actionSelected = "Send file" then
set filepath to POSIX path of (choose file)
display dialog "Please enter IP address of receiver:" default answer ""
set ipAddress to text returned of result
if ipAddress = "" then
repeat
display dialog "IP address cant be blank,Please enter IP address of receiver:" default answer ""
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
Deploying a Rails 3 App with EC2 + S3 + Ubuntu + Capistrano + Passenger
=======================================================================
EC2 Setup
---------
1 Launch New ec2 instance - ami-1634de7f
2 Create elastic IP [ELASTIC_IP] and associate it with instance
3 go to domain registrar DNS settings, @ and www to ELASTIC_IP
4 set the `:host` in `config/deploy.rb` to ELASTIC_IP

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email