Skip to content

Instantly share code, notes, and snippets.

View vireshas's full-sized avatar
:octocat:

Viresh Sanagoudar vireshas

:octocat:
View GitHub Profile
@vireshas
vireshas / aws-s3-rename.coffee
Created November 8, 2016 14:04 — forked from roparz/aws-s3-rename.coffee
Rename object with Node.js AWS S3 (copy object then delete object) with promises
config = require 'config'
s3 = require 's3'
q = require 'q'
module.export = (oldKey, newKey) ->
defer = q.defer()
params =
# you need to set the s3 bucket in the CopySource key
CopySource: "#{ config.s3.bucket }/#{ oldKey }"
import React from 'react'
import { render } from 'react-dom'
import { Match, Link, BrowserRouter as Router } from 'react-router'
import matchSorter from 'match-sorter'
import './styles.css'
const API = 'http://localhost:3000'
const token = localStorage.booksToken || Math.random().toString()
localStorage.booksToken = token
@vireshas
vireshas / xpub-xsub.js
Created September 26, 2016 04:04 — forked from tjanczuk/xpub-xsub.js
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
@vireshas
vireshas / raspberry-pi-vpn-router.md
Created September 19, 2016 15:03 — forked from superjamie/raspberry-pi-vpn-router.md
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@vireshas
vireshas / binaries download
Created August 26, 2016 10:06
Download binaries from github
First, to get a list of the assets for the latest release:
curl -H "Authorization: token YOURGITHUBTOKEN" https://api.github.com/repos/NAME/REPO/releases/latest
Then in the JSON, look up the url of the asset you want. For example it would look like: "url": "https://api.github.com/repos/NAME/REPO/releases/assets/1275759"
Then you pass this to another curl command to retrieve the actual URL, which is actually a link to an Amazon S3 file.
curl -H "Authorization: token YOURGITHUBTOKEN" -H "Accept:application/octet-stream" -i https://api.github.com/repos/NAME/REPO/releases/assets/1275759
The URL will be in the "location" field of the HTTP response, and then use curl to get the file like this:
@vireshas
vireshas / web-fonts-asset-pipeline.md
Created August 18, 2016 02:42 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@vireshas
vireshas / doc.md
Created July 31, 2016 13:15 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

@vireshas
vireshas / mixin_in_subclass.rb
Last active July 29, 2016 04:33
mixin in sub-class
module C
def a
puts "a"
end
end
class A
include C
end
@vireshas
vireshas / player
Created July 21, 2016 07:16 — forked from isaiah/player
An audio player in golang.
package main
import (
"bytes"
"code.google.com/p/portaudio-go/portaudio"
"encoding/binary"
"fmt"
"io"
"log"
"os"
@vireshas
vireshas / rtmp-nchan-buffer-oracle
Created July 6, 2016 17:12
nginx other modules
--add-module='/home/www/source/nginx-rtmp-module' --add-module='/home/www/source/nchan-0.99.16' --with-openssl='/home/www/source/openssl-1.0.1t'