This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import json | |
| import awkward | |
| import pandas | |
| import requests | |
| # [Spotify Web API](https://developer.spotify.com/documentation/web-api/reference/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # [vbfhn - Notes of gen-production](https://docs.google.com/document/d/1_QVUkCEOtk3ZRdC1dl6DSHnPOGmct64vPnZTc0CuqEs/) | |
| WORKDIR="${WORK:-${PWD}}" | |
| MADGRAPHDIR="${WORKDIR}/GenProductions/bin/MadGraph5_aMCatNLO" | |
| CARDPROCESS='SingleVectorLQ_M500' | |
| CARDDIR="cards/production/2017/13TeV/SingleVectorLQ/PdfLo/${CARDPROCESS}" | |
| GRIDPACK="${MADGRAPHDIR}/${CARDPROCESS}_slc7_amd64_gcc700_CMSSW_10_6_19_tarball.tar.xz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # [Extract all Images from PDF in Python](https://aliarefwriorr.medium.com/extract-all-images-from-pdf-in-python-cda3dc195abd) | |
| import io | |
| import fitz | |
| import os | |
| import PIL.Image | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from lxml.html import fromstring | |
| from pandas import concat, DataFrame, Series | |
| from requests import get | |
| from string import ascii_uppercase | |
| def parseListOfCommonMisspellings(char:str) -> DataFrame: | |
| '''Scrape and parse [Wikipedia's list of common misspellings](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings) and return as a pandas.DataFrame''' | |
| url = f'https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/{char}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Writes AutoHotkey hotkey-based script from JuliaLang tab completions for Unicode characters | |
| # Inspired by: | |
| # [I created a (Linux) script to easily type Unicode math everywhere](https://www.reddit.com/r/Physics/comments/pc08mg/i_created_a_linux_script_to_easily_type_unicode/) | |
| from lxml.html import fromstring | |
| from numpy import array_split | |
| from requests import get | |
| from typing import TextIO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import json, os, pandas, requests, sys, typing | |
| def getToken(jsonFilePath:str) -> str: | |
| '''Read "token" key from json file''' | |
| try: | |
| with open(jsonFilePath, 'r') as jsonFile: token = json.load(jsonFile).get('token') | |
| if token == 'api_key': raise Exception | |
| except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import pandas | |
| import shlex | |
| def brilcalcLumiQuery(outputstyle:str='csv', cerntime:bool=False, tssec:bool=True, unit:str='/fb', **kwargs) -> str: | |
| ''' | |
| Format brilcalc query string. Keyword arguments are expected to specify the query. | |
| See [https://cms-service-lumi.web.cern.ch/cms-service-lumi/brilwsdoc.html#brilcalc] for more info. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| class C: | |
| # [https://stackoverflow.com/a/287944/13019084] | |
| # [https://janakiev.com/blog/python-shell-commands/] | |
| # [https://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html] | |
| reset = os.popen('tput sgr 0 0').read() # Turn off all attributes | |
| bold = os.popen('tput bold').read() # Begin double intensity mode | |
| uline = os.popen('tput smul').read() # Begin underscore mode | |
| class F: # foreground |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # [https://github.com/vega/vega-datasets] | |
| import lxml.html, lxml.cssselect, pandas, requests | |
| # [https://lxml.de/] [https://lxml.de/cssselect.html] | |
| def vegaDatasets(dataset:str=None) -> pandas.DataFrame: | |
| def checkExt(dataset:str, ext:str): return dataset.split('.')[-1] == ext | |
| def availableDatasets(url:str): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| Args(){ | |
| # Metafunction that expects "$FUNCNAME" (name of parent function), the positional parameters passed to a parent function, an ASCII "record separator" delimiter, and the variable names for the required & optional arguments | |
| # Variable names for optional arguments should be indicated by wrapping them in square brackets. A default value for optional arguments may be indicated by an equal sign, e.g. '[optionalVariable=defaultValue]' | |
| # The passed positional parameters are assigned to the variable names and returned as global variables using `printf -v` (optional positional parameters may be skipped with a quoted empty string, '') | |
| # If any required parameters are missing, printUsage() is executed (prints the expected positional parameters) and an exit code of 111 is returned | |
| local functionName posParam varName sqRegex eqRegex red reset # [https://wiki.bash-hackers.org/commands/builtin/local] | |
| functionName="$1"; shift # [https://wiki.bash-hackers.org/syntax/shellvar |
NewerOlder