Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
Promote Open Source To Next Level

Chuong Ho chuongmep

💬
Promote Open Source To Next Level
View GitHub Profile
View kill.bat
REM Program: kill.bat
REM Purpose: Kill process boring autodesk
REM Author: Chuong.Ho
REM Date: 2022-11-24
REM Version: 1.0
REM
REM get all process
tasklist /fo csv > process.csv
REM show process.csv
type process.csv
View matchdatetimesupport.py
import regex as re
# pattern match correct with string datetime format dd/mm/yyyy
pattern = re.compile(r'^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/((19|20)\d\d)$')
# pattern = re.compile(r'(\d{1,2})/(\d{1,2})/(\d{2,4})')
# test list of dates
test_dates = ['01/01/2019', '01/01/19', '21/11/22', '01/01/2019', '01/01/2019 01:01:01', '01/01/19 01:01:01', '1/1/2019 01:01:01', '1/1/19 01:01:01']
print("Test for correct dates with dd/mm/yyyy format")
# check if match
for date in test_dates:
View IsPointInPolyFunction.cs
bool IsPointInPoly(List<Vector> coordinates, Vector testPoint)
{
bool result = false;
int j = coordinates.Count() - 1;
for (int i = 0; i < coordinates.Count(); i++)
{
if (coordinates[i].y < testPoint.y && coordinates[j].y >= testPoint.y ||
coordinates[j].y < testPoint.y && coordinates[i].y >= testPoint.y)
{
if (coordinates[i].x + (testPoint.x - coordinates[i].y) / (coordinates[j].y - coordinates[i].y) *
View compressDirectory.cs
void compressDirectory(string DirectoryPath, string OutputFilePath, int CompressionLevel = 9)
{
try
{
// Depending on the directory this could be very large and would require more attention
// in a commercial package.
string[] filenames = Directory.GetFiles(DirectoryPath);
// 'using' statements guarantee the stream is closed properly which is a big source
View ForgePythonSDKConnectSpeckle.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View dynamep.csproj
<Target Name="AfterBuild">
<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.8">
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
</GetReferenceAssemblyPaths>
<GetAssemblyIdentity AssemblyFiles="$(OutDir)$(TargetName).dll">
<Output TaskParameter="Assemblies" ItemName="AssemblyInfo" />
</GetAssemblyIdentity>
<GenerateResource SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" UseSourcePath="true" Sources="$(ProjectDir)\Resources\DynaMEPimages.resx" OutputResources="$(ProjectDir)\Resources\DynaMEPimages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
<AL SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" TargetType="library" EmbedResources="$(ProjectDir)\Resources\DynaMEPimages.resources" OutputAssembly="$(OutDir)DynaMEP.customization.dll" Version="%(AssemblyInfo.Version)" />
</Target>
View ifcopenshelldemo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ForgePythonSDK.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View SraperBIMObject.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Py_Initialize.cpp
#define PY_SSIZE_T_CLEAN
#include <Python.h>
int
main(int argc, char *argv[])
{
PyObject *pName, *pModule, *pFunc;
PyObject *pArgs, *pValue;
int i;