Skip to content

Instantly share code, notes, and snippets.

View chuongmep's full-sized avatar
👋
Loading...

Chuong Ho chuongmep

👋
Loading...
View GitHub Profile
private static bool TryAttachVisualStudioDebugger(int processId)
{
try
{
// Get the DTE object for the current Visual Studio instance
var dte = GetCurrentVisualStudioDTE();
if (dte == null)
return false;
// Get the debugger
# print all tz_abbreviations from ptz
from datetime import datetime
from zoneinfo import ZoneInfo
# get all tz_abbreviations from ptz
from zoneinfo import available_timezones
tz_abbreviations = {}
utc_now = datetime.utcnow()
for tz in sorted(available_timezones()):
try:
local_time = utc_now.replace(tzinfo=ZoneInfo("UTC")).astimezone(ZoneInfo(tz))
# %pip install ifcopenshell
# %pip install ifcpatch
import ifcopenshell
# Load an IFC file
ifc_file = ifcopenshell.open("Snowdon Towers Sample Architectural.ifc")
import ifcpatch
from ifcpatch.recipes import Ifc2Sql
# For SQLite
patcher = Ifc2Sql.Patcher(
from fastapi import FastAPI, HTTPException
import duckdb
import pandas as pd
import os
app = FastAPI()
# Kết nối đến DuckDB file (hoặc dùng ':memory:')
conn = duckdb.connect("my_database.duckdb")
@app.get("/")
$parentKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Bluetooth\ExceptionDB\Addrs"
if (Test-Path $parentKey) {
Get-ChildItem -Path $parentKey | ForEach-Object {
Remove-Item -Path $_.PsPath -Recurse -Force
}
Write-Output "All subkeys under 'Addrs' deleted."
} else {
Write-Output "'Addrs' key not found."
}
public static List<XYZ> ComputeConvexHull(List<XYZ> points)
{
if (points == null || points.Count < 3)
throw new ArgumentException("At least 3 points are required to compute a convex hull");
List<XYZ> hull = new List<XYZ>();
// Find the leftmost point
XYZ leftmost = points[0];
foreach (var point in points)
import psutil
def get_all_ports():
ports = set()
for proc in psutil.process_iter(['pid', 'name']):
try:
connections = proc.net_connections()
for conn in connections:
if conn.laddr.port:
ports.add(conn.laddr.port)
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.DB.Analysis;
[Transaction(TransactionMode.Manual)]
public class PickCurveAndCreateDirectShape : IExternalCommand
{
public Result Execute(
class ModelData2 {
constructor(viewer) {
this._modelData = {};
this._viewer = viewer;
}
init(callback) {
let _this = this;
_this.getAllLeafComponents(function (dbIds) {
let count = dbIds.length;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.