Skip to content

Instantly share code, notes, and snippets.

@matthew-brett
matthew-brett / reset_boot_disk.py
Created July 13, 2022 11:41
Script to do VMDK disk reset after reboot
#!/usr/bin/env python
""" Reset disk for VirtualBox vmdk
"""
import os.path as op
from subprocess import check_output
import plistlib
import re
from argparse import ArgumentParser, RawDescriptionHelpFormatter
#!/usr/bin/env python3
""" Show bluetooth power for named device on macOS
"""
import sys
import json
from subprocess import check_output, DEVNULL
from argparse import ArgumentParser, RawDescriptionHelpFormatter
r_local_dir <- file.path('C:', 'R')
r_tmp_dir <- file.path(r_local_dir, 'tmp')
r_inst_dir <- file.path(r_local_dir, 'win-library', '4.0')
dir.create(r_tmp_dir, recursive=TRUE)
dir.create(r_inst_dir, recursive=TRUE)
r_user_dir <- Sys.getenv('R_USER')
r_env_fn <- file.path(r_user_dir, '.Renviron')
write(paste("TMPDIR='", r_tmp_dir, "'", sep=''), r_env_fn)
write(paste("R_LIBS_USER='", r_inst_dir, "'", sep=''), r_env_fn, append=TRUE)
#!/usr/bin/env python3
import sys
import json
from subprocess import check_output, DEVNULL
from argparse import ArgumentParser, RawDescriptionHelpFormatter
def get_parser():
parser = ArgumentParser(description=__doc__, # Usage from docstring
SELECT pip_version, distro_name, distro_version, libc_version, bits, download_count
FROM (
SELECT REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(details.distro.name), " (gnu/)?linux", ""), "^red.?hat.*", "redhat"), "os x","macos") AS distro_name,
details.distro.version as distro_version,
details.distro.libc.version as libc_version,
REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(file.filename, ".*manylinux.*_i686.whl$", "32"), ".*manylinux.*_x86_64.whl$", "64"), ".*manylinux.*", "") AS bits,
details.installer.version as pip_version,
COUNT(*) AS download_count,
FROM `the-psf.pypi.downloads*`
WHERE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
select pip_version, distro_name, distro_version, libc_version, (download_count / total * 100) as percent
from (
SELECT REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(details.distro.name), " (gnu/)?linux", ""), "^red.?hat.*", "redhat"), "os x","macos") AS distro_name,
details.distro.version as distro_version,
details.distro.libc.version as libc_version,
details.installer.version as pip_version,
COUNT(*) AS download_count,
SUM(COUNT(*)) OVER () AS total
FROM `the-psf.pypi.downloads*`
WHERE
select pip_version, distro_name, distro_version, (download_count / total * 100) as percent
from (
SELECT REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(details.distro.name), " (gnu/)?linux", ""), "^red.?hat.*", "redhat"), "os x","macos") AS distro_name,
details.distro.version as distro_version,
details.installer.version as pip_version,
COUNT(*) AS download_count,
SUM(COUNT(*)) OVER () AS total
FROM `the-psf.pypi.downloads*`
WHERE
details.installer.version IS NOT NULL
select distro_name, distro_version, libcv, (download_count / total * 100) as percent
from (
SELECT REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(details.distro.name), " (gnu/)?linux", ""), "^red.?hat.*", "redhat"), "os x","macos") AS distro_name,
details.distro.version as distro_version,
details.distro.libc.version as libcv,
COUNT(*) AS download_count,
SUM(COUNT(*)) OVER () AS total
FROM `the-psf.pypi.downloads*`
WHERE
details.distro.name IS NOT NULL