Skip to content

Instantly share code, notes, and snippets.

View vibhavsinha's full-sized avatar

Vibhav Sinha vibhavsinha

View GitHub Profile
@vibhavsinha
vibhavsinha / te-date.js
Last active September 17, 2022 02:27
Textexpander snippet for date formatting with configurable options. Made to run on both text-expander and as node cli for testing.
// Use tab keys to quickly go to OK button
let dateFormat = '%fillpopup:name=dateFormat:default=YYYY-MM-DD:MMM DD, YYYY:DD/MM/YY:MM/DD/YY:none%';
let timeFormat = '%fillpopup:name=timeFormat:HH MM:HH MM SS:default=HH MM ZONE:HH MM SS ZONE:none%';
let hour24 = '%fillpart:name=24 hour format:default=yes%hour24%fillpartend%';
let includeYear = '%fillpart:name=Include year:default=yes%includeYear%fillpartend%';
// keeping these at the top because TextExpander has to show the
// full function code every time.
// This is very long code. Use tab keys to quickly go to ok button.
// Time options have spaces instead of colons because I couldn't

Keybase proof

I hereby claim:

  • I am vibhavsinha on github.
  • I am vibhavsinha (https://keybase.io/vibhavsinha) on keybase.
  • I have a public key whose fingerprint is 4711 4DE1 36FC 4B6E B8F8 55FA A330 F546 8A6C 36DF

To claim this, I am signing this object:

@vibhavsinha
vibhavsinha / .tmux.conf
Created February 14, 2017 12:25
tmux configuration
# for Vim user, this makes navigation easier
setw -g mode-keys vi # I especially like being able to search with /,? when in copy-mode
bind-key C-y run "tmux show-buffer | xclip -sel clip -i" \;
bind-key -n C-Left previous-window
bind-key -n C-Right next-window
#shift arrow to change panes
bind-key -n S-Left select-pane -L
bind-key -n S-Right select-pane -R
bind-key -n S-Up select-pane -U
bind-key -n S-Down select-pane -D
@vibhavsinha
vibhavsinha / altnode.sh
Created January 1, 2017 19:02
Simple node version manager in 4 lines
#!/bin/sh
ls ~/Downloads/node_versions | awk '{print NR"\t"$0}'
read index
val=`ls ~/Downloads/node_versions | head -n $index | tail -1`
ln -sf ~/Downloads/node_versions/$val/bin/node ~/bin/node
@vibhavsinha
vibhavsinha / sampleIAM_PermissionForImport
Created December 29, 2016 19:18
sample IAM permission required for s3 to vdocipher import
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "vdocipherS3VideoImport",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
@vibhavsinha
vibhavsinha / fileUtils.js
Created December 15, 2016 18:44
Recursively reading a directory keeping things asynchronous using promises. Don't ask why!! :)
let fs = require('fs');
let path = require('path');
let wildcard = require('wildcard');
let bluebird = require('bluebird');
bluebird.promisifyAll(fs);
/**
* Fileutils provides utilities for doing file/folder listing
* adding all files in directory excluding ignored files and parsing
@vibhavsinha
vibhavsinha / vdocipherNode.js
Created December 7, 2016 13:24
sample code to generate OTP on nodejs
/// this is the backend code. Use the generated OTP in this file to embed videos using embed code as given on
/// https://www.vdocipher.com/page/api.curl
let request = require('request');
var api_url = "https://api.vdocipher.com/v2/";
var secret_key = "API_SECRET_KEY";
function getOtp(v, c) {
request.post({
@vibhavsinha
vibhavsinha / newApiSample.php
Created November 4, 2016 05:49
Sample php implementation of the new API
<?php
class VdoCipherApi {
private static $APIKEY = "API_SECRET_KEY"; // replace with api key
public function vdoApi($method, $action, $params = [], $post_data = []) {
$ch = curl_init("http://dev.vdocipher.com/api");
$url = "https://dev.vdocipher.com/api" . $action;
if (count($params) > 0) {
$url .= '?' . http_build_query($params);
@vibhavsinha
vibhavsinha / vdocipher.py
Last active March 24, 2020 23:31
Python3 implementation of VdoCipher API
import requests
class vdocipher() :
values = {}
def __init__(self, csk):
self.values[ 'clientSecretKey' ] = csk
def getOtp(self, video, annotate=None, forcedBitrate=None):
url = 'https://api.vdocipher.com/v2/otp?video='+video
@vibhavsinha
vibhavsinha / .vimrc
Last active October 16, 2022 14:47
vimrc file
set nocompatible " be iMproved, required
filetype off " required
syntax on
set ignorecase
set smartcase
let mapleader=','