Skip to content

Commit

Permalink
many files again, + again a new cpp program
Browse files Browse the repository at this point in the history
  • Loading branch information
hearues-zueke-github committed Dec 13, 2021
1 parent a3fd403 commit db04c89
Show file tree
Hide file tree
Showing 17 changed files with 1,741 additions and 54 deletions.
73 changes: 73 additions & 0 deletions bits/bits_challanges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#! /usr/bin/env -S /usr/bin/time /usr/bin/python3.9.5 -i

# -*- coding: utf-8 -*-

# Some other needed imports
import datetime
import dill
import gzip
import os
import pdb
import re
import sys
import traceback

import numpy as np
import pandas as pd
import multiprocessing as mp

from collections import defaultdict
from copy import deepcopy, copy
from dotmap import DotMap
from functools import reduce
from hashlib import sha256
from io import BytesIO
from memory_tempfile import MemoryTempfile
from shutil import copyfile
from pprint import pprint
from typing import List, Set, Tuple, Dict, Union, Any
from PIL import Image

CURRENT_WORKING_DIR = os.getcwd()
PATH_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
HOME_DIR = os.path.expanduser("~")
TEMP_DIR = MemoryTempfile().gettempdir()
PYTHON_PROGRAMS_DIR = os.path.join(HOME_DIR, 'git/python_programs')

# set the relative/absolute path where the utils_load_module.py file is placed!
sys.path.append(PYTHON_PROGRAMS_DIR)
from utils_load_module import load_module_dynamically

var_glob = globals()
load_module_dynamically(**dict(var_glob=var_glob, name='utils', path=os.path.join(PYTHON_PROGRAMS_DIR, "utils.py")))
load_module_dynamically(**dict(var_glob=var_glob, name='utils_multiprocessing_manager', path=os.path.join(PYTHON_PROGRAMS_DIR, "utils_multiprocessing_manager.py")))

mkdirs = utils.mkdirs
MultiprocessingManager = utils_multiprocessing_manager.MultiprocessingManager

OBJS_DIR_PATH = os.path.join(PATH_ROOT_DIR, 'objs')
mkdirs(OBJS_DIR_PATH)

PLOTS_DIR_PATH = os.path.join(PATH_ROOT_DIR, 'plots')
mkdirs(PLOTS_DIR_PATH)

def bit_kth_remove(n, k):
print('Hello There')


def find_and_execute_function():
with open('bits_challanges.py', 'r') as f:
content = f.read()

a = re.search(r'def bit_kth_remove\(n, k\):\n( .*\n)+', content)
f_str = a.string[a.start():a.end()]

return content, f_str

if __name__ == '__main__':
print("Hello World!")

n = 123654
print("n: {}".format(n))
n_bits = bin(n)[2:]
print("n_bits: {}".format(n_bits))
10 changes: 10 additions & 0 deletions cpp_programs/Makefile_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DEFAULT_GOAL := all

CC=g++
CFLAGS=-Wall -std=c++20

utils:
$(CC) $(CFLAGS) utils.cpp -c
main: utils
$(CC) $(CFLAGS) main.cpp utils.o -o main.o
all: main
12 changes: 12 additions & 0 deletions cpp_programs/main_template.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>

using namespace std;

using std::cout;
using std::endl;

int main(int argc, char* argv[]) {
cout << "Hello World!" << endl;

return 0;
}
12 changes: 12 additions & 0 deletions cpp_programs/multi_linear_sequences/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DEFAULT_GOAL := all

CC=g++
CFLAGS=-Werror -Wall -std=c++20 -g
# CFLAGS=-Werror -Wall -std=c++20 -O2 -g
# CFLAGS=-Wall -std=c++20

utils: utils.cpp
$(CC) $(CFLAGS) utils.cpp -c
main: main.cpp utils
$(CC) $(CFLAGS) main.cpp utils.o -o main.o
all: main
Loading

0 comments on commit db04c89

Please sign in to comment.