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 / here_hold_my_coffee.rb
Last active May 17, 2018 07:20
Dev: how do i define_methods on a class?
class C
class << self
define_method(:a) do |msg|
"hello #{msg}"
end
end
end
puts C.a("world")
@vireshas
vireshas / main.go
Created January 8, 2018 06:40 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
#colleague asks
class A
attr_accessor :b,:d
def a
self.b = 10
@d = 20
end
@vireshas
vireshas / split_wav.py
Created November 16, 2017 12:16 — forked from rudolfbyker/split_wav.py
Split WAV files at silence
#!/usr/bin/env python
from scipy.io import wavfile
import os
import numpy as np
import argparse
from tqdm import tqdm
# Utility functions
<html>
<head>
<script type="text/javascript" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/clappr.rtmp/0.0.2/rtmp.min.js"></script>
</head>
<body>
<div id="player"></div>
<script>
window.onload = function() {
var player = new Clappr.Player({
@vireshas
vireshas / index.html
Created August 23, 2017 13:03
palette example
<!DOCTYPE html>
<html>
<head>
<script>
var map = {};
var toggle = true;
keyEvent = function(e) {
map[e.keyCode] = e.type == 'keydown';
if(map[17] && map[65]) {
img = document.getElementById("image");
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
Publisher:
# Persist message in a queue
lpush channel1.queue message
# Publish message to any connected subscriber
publish channel1 message
Subscriber:
# Subscribe to channel1
subscribe channel1
package main
import (
"encoding/json"
"fmt"
)
func main() {
mapD := map[string]interface{}{"deploy_status": "public", "status": "live", "version": 2}
mapB, _ := json.Marshal(mapD)
@vireshas
vireshas / compress.go
Created June 1, 2017 06:41 — forked from iamralch/compress.go
ZIP archives in Golang
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)