Skip to content

Instantly share code, notes, and snippets.

View thekoushik's full-sized avatar
👋
I may be slow to respond.

Koushik Seal thekoushik

👋
I may be slow to respond.
View GitHub Profile
@thekoushik
thekoushik / impossible.js
Last active November 9, 2016 06:30
Impossible Math
/*
The Impossible Math Solver
There will be a predefined target and the process will start with 2 numbers. There will be a set
of predefined operations from which any operation can be used any number of times in any order.
Each operation will accept 2 numbers. First one is the output of the previous operation and the
second one is any number generated from previous operations. Generated numbers must be unique.
The goal is to create a list of operation where the last operation will generate the predefined
target.
@thekoushik
thekoushik / WordMatch.js
Created February 2, 2017 13:42
Javascript String Partial Word Match
function wordMatch(s1,s2){
var a1=s1.toLowerCase().split(/[^A-Za-z]/);
var a2=s2.toLowerCase().split(/[^A-Za-z]/);
for(var i=0;i<a1.length;i++)
if(a2.indexOf(a1[i])>=0)
return true;
return false;
}
@thekoushik
thekoushik / theflash.js
Created February 15, 2017 18:07
"The Flash (CW)" Episode Scraper using NodeJS
/*
"dependencies": {
"chalk": "^1.1.3",
"cheerio": "^0.22.0",
"moment": "^2.16.0",
"superagent": "^2.3.0"
}
Usage:
node theflash [session] where session is optional, latest if not specified
*/
@thekoushik
thekoushik / SerializeBeautifier.php
Created October 8, 2017 16:10
Beautifier for php serialize()
<?php
/**
* @author Koushik Seal <thekoushik.universe@gmail.com>
* @version 1.0
*/
class SerializeBeautifier{
/**
* input for beautify
*
* @var string
@thekoushik
thekoushik / aws_ec2_php56_mysql56.md
Last active October 25, 2018 08:09
AWS EC2 Instance PHP 5.6 and MySQL 5.6

PHP

centos

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum remove php-common
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
/etc/init.d/httpd restart
@thekoushik
thekoushik / connect_robomongo_aws.md
Last active October 5, 2018 04:59
Connect RoboMongo with AWS MongoDB

install mongodb

...

open mongod.conf

vim /etc/mongod.conf

change bindip 127.0.0.1 to 0.0.0.0

@thekoushik
thekoushik / .gitignore
Last active November 3, 2018 10:24
Simple MongoDB REST API
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
@thekoushik
thekoushik / walkietalkie.py
Last active February 11, 2019 15:22
Python LAN Walkie Talkie CLI Application (Python 2.7)
import sys
import os
import socket
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(2)
if "--listen" in sys.argv:
print "WalkieTalkie Listener Turned On.."
server_address = ('', 9434)
@thekoushik
thekoushik / getNested.js
Created February 19, 2019 06:29
Javascript get nested value from object by string path
function getNested(obj,prop){
var _prop=prop.split(".")
for(var i=0;i<_prop.length;i++){
if(_prop[i] in obj)
obj=obj[_prop[i]]
else
return;
}
return obj;
}
@thekoushik
thekoushik / ffmpeg.md
Created August 16, 2019 13:20
ffmpeg tricks

Download and convert m3u8 file to mp4

ffmpeg -i "http://aa.com/a.m3u8" -c copy -bsf:a aac_adtstoasc "movie.mp4"