Skip to content

Instantly share code, notes, and snippets.

@disouzam
Last active December 2, 2025 23:38
Show Gist options
  • Select an option

  • Save disouzam/4fa20b763a89a5d38638b7c97a1262c3 to your computer and use it in GitHub Desktop.

Select an option

Save disouzam/4fa20b763a89a5d38638b7c97a1262c3 to your computer and use it in GitHub Desktop.
VS Code code snippets
{
// Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"bash code block": {
"prefix": "bash",
"body": [
"```bash",
"$TM_SELECTED_TEXT",
"```"
],
"description": "Insert a block of commands formatted for bash in markdown file"
}
}
{
// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Check Importable Modules": {
"prefix": "importablemodules",
"body": [
"import pkgutil",
"",
"search_path = ['.'] # set to None to see all modules importable from sys.path",
"all_modules = [x[1] for x in pkgutil.iter_modules(path=search_path)]",
"print(\"Available modules to import: \")",
"nmodules=0",
"if len(all_modules) == 0:",
" print(all_modules)",
"for module in all_modules:",
" nmodules+=1",
" print(f\"{nmodules}: Module name: {module}\")"
],
"description": "Check the modules that can be imported at a given time"
},
"List paths appended to sys.path": {
"prefix": "syspath",
"body": [
"import sys",
"",
"print(\"Paths in sys.path:\")",
"npaths=0",
"for pathitem in sys.path:",
" npaths+=1",
" print(f\"{npaths}: Path: {pathitem}\")"
],
"description": "Print the paths that are appended to sys.path"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment