Skip to content

Instantly share code, notes, and snippets.

@asears
asears / paste.py
Created November 30, 2021 12:17
Overlay images with PIL
# https://moonbooks.org/Articles/How-to-overlay--superimpose-two-images-using-python-and-pillow-/
from PIL import Image
import numpy as np
img = Image.open("data_mask_1354_2030.png")
background = Image.open("background_1354_2030.png")
@asears
asears / Microsoft.PowerShell_profile.ps1
Created November 21, 2021 19:39
Powershell profile dotnet autocomplete
# Path to profile
# Write-Output $PROFILE
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
@asears
asears / .bashrc
Created November 21, 2021 19:37
bashrc dotnet cli param completion
# bash parameter completion for the dotnet CLI
_dotnet_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions
completions="$(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)"
if [ $? -ne 0 ]; then
completions=""
@asears
asears / launch.json
Created November 11, 2021 10:55
launch.json for python
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// options are internalConsole, integratedTerminal, externalTerminal, remote, remoteMixed, remoteMixedErrors, remoteMixedOutput, remoteMixedOutputErrors, remoteMixedErrorsOutput, remoteMixedOutputErrors
// use env and envFile to set environment variables
// use cwd for the current working folder of the debugger, defaults to the workspace root
// https://code.visualstudio.com/docs/python/debugging
// schema located at https://code.visualstudio.com/docs/python/debugging#_launchjson-schema
// tricks to get the correct path to the python executable
@asears
asears / venv.md
Created November 11, 2021 10:54
Fixing venv conflicts with Windows and conda and Pandas

Switching to VirtualEnv from Conda might cause some issues with the system path's python and pip installs.

There seems to be a bug.

pip install pandas will setup the install in the Anaconda folder. running pip or pip3.exe files in the scripts folder to install results in error.

Fatal error in launcher: Unable to create process using '"d:\projects\python\venv\scripts\python.exe" "D:\projects\python\venv\Scripts\pip3.exe" install pandas

@asears
asears / connectedcomponents.ipynb
Created October 13, 2021 08:56
kornia - Connected components
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asears
asears / imgtotensor.ipynb
Created October 13, 2021 08:52
Kornia - convert image to tensor
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asears
asears / export_issues.py
Created October 8, 2021 09:43 — forked from reberhardt7/export_issues.py
Github Issues Export: This script exports all issues from a repository, along with comments and events, into a JSON file. It also produces a Markdown file that can be used to easily view the issues.
"""
This script uses Github's API V3 with Basic Authentication to export issues from
a repository. The script saves a json file with all of the information from the
API for issues, comments, and events (on the issues), downloads all of the
images attached to issues, and generates a markdown file that can be rendered
into a basic HTML page crudely mimicking Github's issue page. If the gfm module
is available, the script will go ahead and render it itself.
In the end, you'll be left with a folder containing a raw .json file (which you
can use to extract information for your needs, or to import it somewhere else),
@asears
asears / grep.md
Created September 30, 2021 14:05
Grep examples

Grep

. Find text only in specific file types/extensions – Returns all the search results

grep -ir --include=\*.py text_to_search
  1. If you want to only see the file names, then add the -l filter