Skip to content

Instantly share code, notes, and snippets.

View asears's full-sized avatar

Andrew Sears asears

View GitHub Profile
foreach ($location in @('EastUS')) {
Get-AzVmSize -Location $location | % {
New-Object -TypeName PSobject -Property @{
Name = $_.Name;
NumberOfCores = $_.NumberOfCores;
MemoryInMB = $_.MemoryInMB;
MaxDataDiskCount = $_.MaxDataDiskCount;
OSDiskSizeInMB = $_.OSDiskSizeInMB;
ResourceDiskSizeInMB = $_.ResourceDiskSizeInMB;
Family = $(switch -regex ($_.Name) {
@JustinGrote
JustinGrote / Search-Giphy.ps1
Last active December 23, 2022 16:18
Get a random gif from Giphy. ***NOTE: Invoke-TerminalGif was moved to MSTerminalSettings module***
#requires -module msterminalsettings,threadjob
###QUICKSTART
#FIRST: Run this in your Powershell Windows Terminal: Install-Module threadjob,msterminalsettings -scope currentuser
#THEN: iex (iwr git.io/invoketerminalgif)
#THEN: Get-Help Search-Giphy -Examples
#THEN: Get-Help Invoke-TerminalGif -Examples
#THEN: Search-Giphy | Format-List -prop *
#THEN: Invoke-TerminalGif https://media.giphy.com/media/g9582DNuQppxC/giphy.gif
@shanselman
shanselman / profile.json
Created May 7, 2019 04:22
Windows Terminal Profile
{
"defaultProfile": "{7d04ce37-c00f-43ac-ba47-992cb1393215}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"experimental_showTabsInTitlebar": true,
"requestedTheme": "dark",
"profiles": [
{
#!/bin/bash
#while true; do if [[ "$(hg pull --rebase https://hg.mozilla.org/mozilla-central)" != *"no changes found"* ]]; then if [ $? -eq 0 ]; then hg push try -f; else echo "manual merge required"; exit; fi; else echo "no changes found"; fi; sleep 600; done
while true; do
if [[ "$(hg pull --rebase https://hg.mozilla.org/mozilla-central)" != *"no changes found"* ]]; then
if [ $? -eq 0 ]; then
hg push try -f
else
echo "manual merge required"
@MarvinT
MarvinT / black_code_prettify.json
Last active January 16, 2023 15:41
json you can paste into jupyter notebook's code prettify configuration that makes it use black to reformat your code instead of yapf.
{
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
},
"r": {
"library": "library(formatR)\nlibrary(jsonlite)",
"prefix": "cat(toJSON(paste(tidy_source(text=",
"postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))"
@brianspiering
brianspiering / python_nlp_packages.md
Last active April 8, 2024 20:48
A Hacker's Guide to Python string and Natural Language Processing (NLP) packages

A Hacker's Guide to Python string and Natural Language Processing (NLP) packages

Extraction

  • textract - Extract text from any document.
  • camelot - Extract text from PDF.

Preprocessing

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 10, 2024 05:32
set -e, -u, -o, -x pipefail explanation
@stianlagstad
stianlagstad / pyodbc in Docker with MySQL and Oracle
Created December 21, 2017 21:47
This Dockerfile should get you going with pyodbc in Docker with the drivers to talk to MySQL and Oracle databases
FROM python:3
WORKDIR /usr/src/app
# Copy over the drivers
# MySQL ODBC Ansi
COPY drivers/mysql-connector-odbc-5.3.9-linux-ubuntu16.04-x86-64bit.tar.gz .
# Oracle 11.2
COPY drivers/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm .
COPY drivers/oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm .
@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
DROP DATABASE IF EXISTS 📚;
CREATE DATABASE 📚;
USE 📚;
CREATE TABLE 👤(
🔑 INTEGER PRIMARY KEY,
🗣 varchar(64), -- name
🗓 DATE -- date of registration