Skip to content

Instantly share code, notes, and snippets.

View s1113950's full-sized avatar
🎯
Focusing

Steven Robertson s1113950

🎯
Focusing
View GitHub Profile
@s1113950
s1113950 / scryfall_search.py
Last active June 19, 2022 02:58
Query scryfall + dump card names out for easy import into moxfield
# little script to search for cards in scryfall for commander decks and dump them out in text form
# see https://scryfall.com/docs/api/cards/search
import argparse
import requests
import sys
import time
# Python <= 3.9 hack, need NoneType to parse None values still
if sys.version_info.major == 3 and sys.version_info.minor <= 9:
@s1113950
s1113950 / emoji-creation.md
Last active March 3, 2020 08:01
How to easily make Slack emojis with a Mac + Chrome

Some coworkers wanted to know how I made the majority of our over 2100 custom emojis at Intel, so I thought I'd write down how I did this :) First, Slack emojis are required to be 128X128 pixels, and no larger than 128KB, so you'll want to make sure your image/gif is either really large < 1000 px in either height or width, because you'll be shrinking it way down. 256x256 images usually work the best.

HOW TO FIND EMOJIS

  1. If it's a company/place/idea then often googling {name} {icon|logo|symbol} works just fine, like hp logo to get the logo.
  2. Sometimes image files will be in .svg format, and I use https://ezgif.com/svg-to-png to convert these to png after downloading them.
  3. Click on the first image you see in the top search section of your Google search result. This will take you to Google's images section.
  4. Find the image you want and click on it. This will open it in the right-side column.
  5. Right-click the image/gif on the right, and click save image as.... This will save it and you'll se
./toolchain.py build python3 kivy
./toolchain.py:93: DeprecationWarning: ChromeDownloader style of invoking requests is deprecated. Use newer urlopen functions/methods
urlretrieve = ChromeDownloader().retrieve
[INFO ] Building with 4 processes, where supported
[INFO ] Want to build ['python3', 'kivy']
@s1113950
s1113950 / ssh_env.sh
Created March 17, 2018 00:24
Patch kubernetes deployment with ssh environment -- ANTIPATTERN (but sometimes desired :) )
#!/bin/bash
# YOU NEED install_ssh.sh AND export_env_vars.sh FROM HERE:
# this script assumes you put them in /tmp
# https://gist.github.com/s1113950/0d7cfe3fc88329c4b4ae0cb75750e8aa
# https://gist.github.com/s1113950/039b52c35337b377239bc1f7f37724c5
# CALL IT LIKE THIS: `ssh_env.sh {deployment_name}`
PUB_KEY="${PUB_KEY:-${HOME}/.ssh/id_rsa.pub}"
@s1113950
s1113950 / export_env_vars.sh
Created March 17, 2018 00:08
Exports environment variables to root; useful in patching kubernetes deployment with ssh
#!/bin/bash
OLDIFS=$IFS
IFS=$'\n'
for each in `printenv`; do
echo "export "\'$each\' >> /root/.bashrc
done
IFS=$OLDIFS
@s1113950
s1113950 / install_ssh.sh
Created March 17, 2018 00:02
Installs ssh into container, can be used to patch kubernetes pod
# RUN LIKE THIS:
# kubectl cp "install_ssh.sh" "${pod}":/tmp/install_ssh.sh
# kubectl exec -i "${pod}" -- /tmp/install_ssh.sh
#!/bin/bash
if ! [ -d /etc/apt ]; then
echo "This container OS is not supported"
exit 1
fi
@s1113950
s1113950 / mysql_unique_index_lock_attempt.py
Last active January 31, 2023 20:18
Attempt at fixing https://bugs.mysql.com/bug.php?id=72439 with insert instead and sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from multiprocessing import Process
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Integer
from sqlalchemy import func, UniqueConstraint
Base = declarative_base()
class Models(Base):