Skip to content

Instantly share code, notes, and snippets.

View benyblack's full-sized avatar

Behnam Yousefi benyblack

View GitHub Profile
@benyblack
benyblack / TrieNode.cs
Last active April 13, 2017 13:18
Trie structure in c#
using System;
using System.Collections.Generic;
using System.Linq;
namespace MyTrie {
public class TrieNode {
Dictionary<char, TrieNode> children = new Dictionary<char, TrieNode>();
public int Size { get; set; }
public TrieNode() {
Size = 0;
@benyblack
benyblack / minCoinChange.cs
Created July 21, 2017 07:15
Minimum Coin Change
using System;
using System.Collections.Generic;
public class Solution {
public int CoinChange(int[] coins, int amount) {
if (amount == 0) return 0;
if(coins.Length==1){
if(amount%coins[0]==0)
return amount/coins[0];
else
@benyblack
benyblack / mbp.ahk
Created September 11, 2017 02:40
MyAHK
+BS::send {Del}
^q::send !{F4}
Capslock::Send, {Alt Down}{Shift Down}
KeyWait, Capslock
Send, {Alt Up}{Shift Up}
return
RCtrl & Tab::AltTab
LCtrl & Right::
#MaxHotkeysPerInterval 200
$WheelUp::
Send {WheelDown}
Return
$WheelDown::
Send {WheelUp}
Return
import time
import dateparser
import pytz
import json
import csv
import datetime
from dateutil.rrule import rrule, MONTHLY
from binance.client import Client
import os
import sys
@benyblack
benyblack / stock_chart.py
Last active June 10, 2019 08:21
Stock chart with oscillator using bokeh
import numpy as np
from bokeh.layouts import column
from bokeh.plotting import figure, show, output_file
# imports for the example
import random
from bokeh.sampledata.stocks import AAPL, GOOG, IBM, MSFT
def datetime(x):
return np.array(x, dtype=np.datetime64)
@benyblack
benyblack / Dockerfile
Created October 17, 2019 08:09
Elixir Phoenix helloworld Dockerfile
###########################################################################
# Based on https://gist.github.com/teamon/27ed7e551d188930c9fa0b5e19bd76b7#
###########################################################################
FROM node:latest as build-node
# prepare build dir
RUN mkdir -p /app/assets
WORKDIR /app
# set build ENV
FROM elixir:1.9.2 as mixer
ENV MIX_ENV=test
ENV PORT=4000
# COPY . /app
RUN mkdir /app
WORKDIR /app
RUN mix local.hex --force
version: '3'
services:
database:
image: "postgres"
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: "hello_world_test"
RED='\033[0;31m'
BLUE='\033[1;34m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
R="${BLUE}Running ${NC}"
D="${GREEN}Done! ${NC}"
clear
sleep 1
echo "${BLUE}Create a Postgres server by docker ${NC}"
echo "${R} docker pull postgres"