Skip to content

Instantly share code, notes, and snippets.

@abdullah353
abdullah353 / websocket.js
Created December 27, 2021 16:45 — forked from bearice/websocket.js
My own (and dirty) implementation of WebSocket-Protocol-Version-8 on nodejs
var crypto = require('crypto');
var WSProtocolHandler = {
"8":{
handshake:function(req,socket,head,callback){
var key = req.headers["sec-websocket-key"];
if(!key)return false;
key += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
var sha1 = crypto.createHash('sha1');
sha1.update(key);
@abdullah353
abdullah353 / package.json
Created October 8, 2018 09:36
package.json
{
"name": "My App",
"version": "0.0.0",
"main": "./web-app/index.js",
"scripts": {
"start": "webpack && webpack-dev-server --mode development",
"build": "webpack"
},
"license": "ISC",
"devDependencies": {
@abdullah353
abdullah353 / webpack.config.js
Created October 8, 2018 09:34
webpack.config.js for React + Babel + Webpack + Eslint
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
module.exports = {
mode: 'development',
entry: './web-app/index.js',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
@abdullah353
abdullah353 / technical_indicators.py
Created August 28, 2018 11:59
Technical Indicators
import numpy
import pandas as pd
import math as m
# REF : https://www.quantopian.com/posts/technical-analysis-indicators-without-talib-code
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
return df
@abdullah353
abdullah353 / install-htop.sh
Created September 14, 2017 01:07 — forked from alexandrerocco/install-htop.sh
Amazon Linux - Install htop
# update
sudo yum -y update
sudo yum -y upgrade
# enable EPEL6 by changing enabled=0 -> enabled=1
sudo vim /etc/yum.repos.d/epel.repo
# install htop
sudo yum install htop
@abdullah353
abdullah353 / better-nodejs-require-paths.md
Created August 12, 2017 18:43 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@abdullah353
abdullah353 / .gitlab-ci.yml
Created July 15, 2017 11:20
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH # Required for awscli.
- aws --version # Print out aws cli version for debugging.
@abdullah353
abdullah353 / bobp-python.md
Created April 18, 2017 15:15 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@abdullah353
abdullah353 / query_boto3.py
Created December 14, 2016 15:39 — forked from numberoverzero/query_boto3.py
Query on an involved table, using boto3
import arrow
import boto3
import uuid
dynamodb = boto3.client('dynamodb')
some_id = uuid.uuid4()
some_time = arrow.now()
request = {
'ConsistentRead': False,
@abdullah353
abdullah353 / Aggregations.js
Created November 1, 2015 16:38
MongoDB Queries
# Not only have we been adding wands, but our users have been adding new ones daily! Let's create a list of all the unique wand makers in our database.
db.wands.aggregate(
{
"$group": {
"_id": "$maker"
}
}
)