Skip to content

Instantly share code, notes, and snippets.

View Pk13055's full-sized avatar
🇦🇪
Focusing

Pk13055

🇦🇪
Focusing
View GitHub Profile
import os
import signal
import subprocess
import sys
# Parse command-line arguments.
if len(sys.argv) > 1:
folder = os.path.abspath(sys.argv[1])
else:
folder = os.path.abspath(os.getcwd())
@Pk13055
Pk13055 / index.org
Created September 8, 2020 18:07
Defining a parser and syntax checker

ARITHMETIC Language

The Assignment is about implementing the ARITHMETIC Language

In this assignment you will be implementing an interpreter for the ARITHMETIC Language, a language of arithmetic expressions.

The language consists of the following:

@Pk13055
Pk13055 / college_configs.py
Created August 10, 2020 16:40
Pass config file(s) and load default vals in `argparse`
#!/usr/bin/env python3
# coding: utf-8
"""
:author: pk13055
:brief: wrapper script for pars initiation
"""
import argparse
import configparser
from multiprocessing import set_start_method
import sys
import requests
import json
import alpaca_trade_api
tickers_list = []
with open('tickers.txt', 'r+') as tickers_file:
tickers_list = tickers_file.read().splitlines()
tenquant_key = 'FAKE_KEY'
@Pk13055
Pk13055 / boost.pc
Created June 3, 2019 09:27
Boost `pkg-config` file for default installation
# Package Information for pkg-config
# Path to where Boost is installed
prefix=/usr/local
# Path to where libraries are
libdir=${prefix}/lib
# Path to where include files are
includedir=${prefix}/include/boost
Name: Boost
@Pk13055
Pk13055 / Dockerfile
Created May 30, 2019 12:17
Ubuntu 16.04 docker with cuda-9.1, cudnn7, dlib, openCV, boost, ffmpeg
FROM nvidia/cuda:9.1-cudnn7-runtime-ubuntu16.04
MAINTAINER <hidden>
# env vars to be loaded at build
ARG http_proxy
ARG https_proxy
ARG no_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy
@Pk13055
Pk13055 / JSON.py
Created April 8, 2019 11:24
Create a json based object with setting and getting using Python dicts
class Tupperware(dict):
MARKER = object()
def __init__(self, value=None):
if value is None:
pass
elif isinstance(value, dict):
for key in value:
self.__setitem__(key, value[key])
else:
@Pk13055
Pk13055 / input_manip.cpp
Created April 3, 2019 15:11
Utility functions to map common file inputs to vectors
#include <bits/stdc++.h>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
using namespace std;
long int n_buffers, buffer_size, output_offset;
string input_buffer;
vector<int> int_tokens;
@Pk13055
Pk13055 / debounce.js
Created March 1, 2019 10:30
Debounce function for throttling input listeners
// https://davidwalsh.name/javascript-debounce-function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
@Pk13055
Pk13055 / parallel.sh
Created December 27, 2018 17:59
Parallel curl version
#!/bin/bash
url=$1
file_size=`curl -sI "$1" | grep "Content-Length" | head -n 1 | cut -d ':' -f 2 | cut -d " " -f 2 | sed "s|\r||g"`
length_of_each_part=`echo $((file_size/10))`
start=0
end=$length_of_each_part
for i in {1..10}
do