This file contains 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
import requests | |
import io | |
import PyPDF2 # pip install PyPDF2 | |
from seleniumwire import webdriver # pip install selenium-wire | |
def payload_from_gene_data(dataset: list[str], signature, cutoff_1, cutoff_2): | |
return { | |
'methodoption': 'os', |
This file contains 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
#!/bin/bash | |
# https://pip.pypa.io/en/stable/installation/#get-pip-py | |
wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py &&\ | |
python /tmp/get-pip.py |
This file contains 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
# Run code below in a shell started by the following command | |
# to guarantee Administrator privileges | |
# Start-Process powershell -Verb runAs | |
function Control-Item-Cmd { | |
param($InputObject) | |
$InputObjectPath = $InputObject.fullname | |
$GrantArg = "{0}:(F)" -f $env:USERNAME |
This file contains 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
FOR /F "tokens=* USEBACKQ" %%g IN (`<command>`) do (SET <variable name>=%%g) |
This file contains 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
#!/bin/bash | |
h=$(whereis -f cudnn.h | cut -f2 -d' ') | |
MAJOR=$(cat $h | grep CUDNN_MAJOR | head -n 1 | cut -f3 -d ' ') | |
MINOR=$(cat $h | grep CUDNN_MINOR | head -n 1 | cut -f3 -d ' ') | |
PATCHLEVEL=$(cat $h | grep CUDNN_PATCHLEVEL | head -n 1 | cut -f3 -d ' ') | |
echo "$MAJOR.$MINOR.$PATCHLEVEL" |
This file contains 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
#!/bin/bash | |
apt update &&\ | |
apt upgrade &&\ | |
apt autoremove |
This file contains 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
# as in https://stackoverflow.com/a/36763172/4449273 | |
import collections | |
def exhaust_iterator(it): | |
collections.deque(it, maxlen=0) |
This file contains 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
RELEASE_URL=https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz | |
wget ${RELEASE_URL} -O Python-src.tgz && tar xzf Python-src.tgz &&\ | |
cd Python-src &&\ | |
./configure --enable-optimizations --with-openssl=$(which openssl) &&\ | |
sudo make altinstall &&\ | |
rm -rf Python-src Python-src.tgz |
This file contains 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
import datetime | |
# ISO formatting | |
datetime.datetime.utcnow() # ('2022-05-10 04:18:09.297644') | |
datetime.datetime.now() # ('2022-05-10 01:18:09.297743') | |
# Custom formatting | |
## Pretty ('Saturday, 15. December 2012 11:19AM') | |
datetime.datetime.now().strftime("%A, %d. %B %Y %I:%M%p") | |
## Calendar ('2012-12-15') |
This file contains 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
# https://techoverflow.net/2019/04/01/how-to-find-zone-of-google-cloud-vm-instance-on-command-line/ | |
gcloud compute instances list --filter='name="${INSTANCE_NAME}"' --format 'get(zone)' | rev | cut -d/ -f1 | rev |
NewerOlder