Skip to content

Instantly share code, notes, and snippets.

#!powershell
#
# powershell -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1
#
# gcloud auth application-default login
$ErrorActionPreference = "Stop"
function checkEnv() {
if ($null -ne $env:ARCH ) {
@datavudeja
datavudeja / Makefile
Created March 7, 2025 21:30 — forked from ticchen/Makefile
Makefile to help install flex server
INSTALL_DIR=/usr/local/flexlm/licenses
#get hostname from license file
licensed_hostname=$(shell cat license.dat | grep ^SERVER | awk '{print $$2}')
licensed_macaddr=$(shell cat license.dat | grep ^SERVER | awk '{print $$3}' | sed -e 's/../\0:/g' -e 's/:$$//' )
help:
# Usage:
# make install # install license server
# make uninstall # uninstall license server
@datavudeja
datavudeja / parse_lmgrd.py
Created March 7, 2025 21:29 — forked from grigory-rechistov/parse_lmgrd.py
lmgrd log file parser
#!/usr/bin/env python2
# The script to parse a lmgrd log and give some license usage metrics
#
# Copyright (c) 2014 Grigory Rechistov <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
@datavudeja
datavudeja / DumpSchemaFromSqliteDB.py
Created February 12, 2025 14:49 — forked from rdapaz/DumpSchemaFromSqliteDB.py
Dump Schema from SQLITE database
# Dump schema from table
"""
Credit to Wilfredo Sánchez Vega who posted this answer
on stackoverflow
https://stackoverflow.com/questions/11996394/is-there-a-way-to-get-a-schema-of-a-database-from-within-python
"""
import sqlite3
import re
import os
from pathlib import Path
@datavudeja
datavudeja / model.py
Created February 12, 2025 14:24 — forked from bao-qian/model.py
sqlite model
import sqlite3
from utils import log
db_path = 'model.sqlite'
conn = sqlite3.connect(db_path)
class Model(object):
fields = [
@datavudeja
datavudeja / log_to_sqlite.py
Created February 12, 2025 14:23 — forked from simonw/log_to_sqlite.py
Class for logging structlog entries to a SQLite database
# Use it like this:
#
# structlog.configure(
# processors=[
# structlog.processors.JSONRenderer(),
# LogToSqlite("/tmp/logs.db")
# ]
# )
# log = structlog.get_logger()
# log.msg("say-hello", whom="world", num=[random.randint(1,55)])
import os
import sqlite3
import json
from biothings import config
from biothings.utils.hub_db import IDatabase
from biothings.utils.dotfield import parse_dot_fields
from biothings.utils.dataload import update_dict_recur
from biothings.utils.common import json_serial
@datavudeja
datavudeja / README.md
Created February 12, 2025 14:22 — forked from pdonorio/README.md
python process lock

Simple and lightweight python process LOCK

Use a lock across python processes or threads.

Based on sqlite/sqlalchemy implementation. Tested on python 3.4+.

To see how it works launch process.py multiple times.

import json
import sqlite3
repodata = json.load(open("497deca9.json"))
COLS = 'filename, build, build_number, depends, license, license_family, md5, name, sha256, size, subdir, timestamp, version'.split(', ')
db = sqlite3.connect("497deca9.sqlite")
db.execute("create table repodata ({}, primary key (filename))".format(','.join(COLS)))
import llm
import sqlite_utils
import numpy as np
from scipy.cluster.hierarchy import linkage, cut_tree
from collections import defaultdict
collection_path = "your path here"
db = sqlite_utils.Database(collection_path)
collection = llm.Collection("pocket", db, create=False)