Skip to content

Instantly share code, notes, and snippets.

View rlabbe's full-sized avatar

Roger Labbe rlabbe

  • SF Bay Area, California
View GitHub Profile
rem Build static Qt 6.8.3 DEBUG
echo.
echo === Cleaning previous build ===
if exist CMakeCache.txt del CMakeCache.txt
for /d %%d in (CMakeFiles*) do if exist "%%d" rmdir /s /q "%%d"
echo.
echo === Configuring ===
call configure.bat -static -static-runtime -debug -prefix d:\qt\6.8.3\msvc2022_64_static -skip qtwebengine -skip qtwebchannel -skip qtwebview -skip qtpdf -skip qttools -skip qtdoc -skip qttranslations -nomake examples -nomake tests -DPython3_ROOT_DIR=C:/Users/roger/miniconda3
rem Build static Qt 6.8.3 RELEASE
echo.
echo === Cleaning previous build ===
if exist CMakeCache.txt del CMakeCache.txt
for /d %%d in (CMakeFiles*) do if exist "%%d" rmdir /s /q "%%d"
echo.
echo === Configuring ===
call configure.bat -static -static-runtime -release -prefix d:\qt\6.8.3\msvc2022_64_static -skip qtwebengine -skip qtwebchannel -skip qtwebview -skip qtpdf -skip qttools -skip qtdoc -skip qttranslations -nomake examples -nomake tests -DPython3_ROOT_DIR=C:/Users/roger/miniconda3
@rlabbe
rlabbe / Windows Defender Exclusions VS 2022.ps1
Created June 25, 2025 19:48 — forked from Braytiner/Windows Defender Exclusions VS 2022.ps1
Adds Windows Defender exclusions for Visual Studio 2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\Downloads\HeidiSQL_11.3_64_Portable') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
import os
import winreg
''' find all duplicate and invalid paths in your user account on windows'''
def expand_env_vars(paths: list[str]) -> list[str]:
return [os.path.expandvars(path) for path in paths]
def find_invalid_paths():
user_paths, system_paths = get_user_and_system_paths()
combined_paths = user_paths + system_paths
Git diff on Jupyter notebook to ignore most of the irrelevant output cell changes
$ git diff 5579009 -I image/png -I execution_count -I \"version\":
minimal log to just see commit, author, and one line comment
$ git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
git config --global alias.jdiff "diff -I image/png -I execution_count -I \"version\"::
@rlabbe
rlabbe / putf.cpp
Created December 4, 2018 22:48
putf implementation
#include <stdarg.h>
// simple implementation of the proposed std::putf
// int i = 3;
// auto d = 3.1415926;
// cout << putf("%03di -> %.3f", i, d) << endl;
std::string putf(const char* format, ...)
{
va_list args;
@rlabbe
rlabbe / attr_dict.py
Created September 12, 2018 17:07
AttrDict
class AttrDict(dict):
"""
dict that lets you access any key via attribute:
x['hi'] or x.hi
"""
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
def __repr__(self):
@rlabbe
rlabbe / as_dict.py
Created March 15, 2018 13:33
numpy recarray to dict
def as_dict(rec):
""" turn a numpy recarray record into a dict. this is mostly useful
just to have a human readable output of a record on the console.
as_dict(my_data[234])
"""
return {name:rec[name] for name in rec.dtype.names}
@rlabbe
rlabbe / camel_to_snake.py
Created February 27, 2018 20:51
camel case to snake case
def camel_to_snake(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
# convert comma separated csv header
keys = header.split(',')
keys = [camel_to_snake(k) for k in keys]
header = ','.join(keys)
@rlabbe
rlabbe / spyder_startup.py
Last active June 10, 2019 22:46
Make spyder act like I want
rom subprocess import call, Popen
import sys
import matplotlib as mpl
import numpy
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def npp(precision=4):