Skip to content

Instantly share code, notes, and snippets.

View gauravchl's full-sized avatar
🌏
🧘‍♂️

Gaurav Chikhale gauravchl

🌏
🧘‍♂️
View GitHub Profile
@gauravchl
gauravchl / getSize.js
Last active October 3, 2017 05:57
get image size without downloading full image,
// Currently works for jpeg only,
// CROS should be enable
// JPEG SPECS:
// http://vip.sugovica.hu/Sardi/kepnezo/JPEG%20File%20Layout%20and%20Format.htm
async function getSize(url) {
const response = await fetch(url);
const reader = response.body.getReader();
const {value, done} = await reader.read();
@gauravchl
gauravchl / sw.js
Last active June 10, 2017 09:09
Default service worker for github pages
const APP_PREFIX = 'repo-name'
const VERSION = '0.0.0.1'
const CACHE_NAME = APP_PREFIX + VERSION
const URLS = [
'/repo-name/',
'/repo-name/index.html',
'/repo-name/main.css',
'/repo-name/sw.js',
]
self.addEventListener('install', e => e.waitUntil(swInstall()))
@gauravchl
gauravchl / obs config
Created May 30, 2017 07:41
OBS recorder config
Output:Recording:
Format: mkv
Recorder: x264
Rate Control: CBR
BitRate: 1500
CPUUsages: Medium
Video:
BaseRes: 1440x900
OutputRes: 1440x900
ufw status # list firwall status
ufw allow 81/tcp # open 81 port
ufw deny 81/tcp # deny 81 port
ufw delete allow 81/tcp # Delete 81 port rule
ufw delete deny 81/tcp # Delete 81 port rule
netstat -tulpn # list processes assigned to port
@gauravchl
gauravchl / do.sh
Last active March 13, 2018 08:03
initial setup for droplet(digital ocean)
# Create new user and add keys
adduser sammy
usermod -aG sudo sammy
su - sammy
mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys # add public key by copy and paste
chmod 600 ~/.ssh/authorized_keys
@gauravchl
gauravchl / atom.md
Last active March 28, 2018 06:21
Apps and configs for osx enviroment
@gauravchl
gauravchl / syncMovieAndSrt.js
Created August 20, 2016 10:16
A simple javascript to rename the .srt filename to it's movie file. Note: currently support .mkv file only & both mkv and srt should be in same directory.
'use strict';
const fs = require('fs');
const path = process.argv[2];
console.log('\n\nRunning script...');
if (!path) {
console.log('Please provide a path');
process.exit();
}
@gauravchl
gauravchl / es6-import-export.md
Last active April 3, 2016 08:40
ES6 import export cheat

module.js

var x = 10;
var y = 20;
export {x, y};
export default x;

main.js

var SomeClass = (function () {
//private vars
var bar = 1;
//constructor
var SomeClass = function () {
}
//public api
var exports = SomeClass.prototype;