Skip to content

Instantly share code, notes, and snippets.

View zahmadsaleem's full-sized avatar
👋

Ahmad Saleem zahmadsaleem

👋
View GitHub Profile
@zahmadsaleem
zahmadsaleem / ifcopenshell.lambda.Dockerfile
Created March 13, 2023 21:24
Dockerfile to create a continer for AWS Lambda with ifcopenshell
# references: https://github.com/IfcOpenShell/IfcOpenShell/issues/2295#issuecomment-1219441082
ARG FUNCTION_DIR="/var/task"
FROM public.ecr.aws/docker/library/python:3.10 AS build
ARG IFC_OPENSHELL_BUILD="31-v0.7.0-cdde536"
RUN apt-get -y update && apt-get -y install unzip curl
ARG FUNCTION_DIR
import math
import os
import threading
import time
# pip install psutil
import psutil
def process_memory(pid):
@zahmadsaleem
zahmadsaleem / deepClone.js
Created May 23, 2021 06:25
Simple recursive deep clone function in JavaScript.
function deepClone(obj) {
let objectType = typeof obj;
if (objectType === "object" && obj !== null) {
return Object.entries(obj).reduce((acc, [key, val]) => {
acc[key] = deepClone(val);
return acc;
}, new obj.constructor());
} else {
return obj;
}
@zahmadsaleem
zahmadsaleem / clean-shell-scripts.sh
Created March 14, 2021 08:52
Clean windows created shell/bash scripts to be run in wsl/linux terminals
sed -i "s/\r//g" $(ls *.sh)
@zahmadsaleem
zahmadsaleem / gh-issue-batch-edit.sh
Created March 7, 2021 06:48
Bulk edit github issues
#!/bin/bash
for i in {535..591}
do
gh issue edit $i --milestone "V2.0" --add-project "Kanban Board"
done
for n in range(101)
if n % 4 is 0:
print (n)