Skip to content

Instantly share code, notes, and snippets.

View HandcartCactus's full-sized avatar

Elias HandcartCactus

  • Acclaim Technical Services
View GitHub Profile
@HandcartCactus
HandcartCactus / darth_pun.py
Last active March 19, 2021 15:33
All possible "Darth *" puns, computed using NLTK and a word list.
"""
Prints all possible puns of the form: "Darth *" Where * is every word that both
starts with "in" and has a negative-connotation, with the "in" removed. This is
based on a joke about the pattern of naming for most sith in the Star Wars franchise, such as
Darth Sidious (i.e. insidious) or Darth Vader (i.e. invader). The results are
funny, I promise. My favorite is "Darth Fection".
"""
import requests as r
import numpy as np
@HandcartCactus
HandcartCactus / cessna.py
Last active March 19, 2021 15:34
Repo to json spec, json spec to repo. Take safe code anywhere you can run python.
import os, json
def tree2dict(abs2rel, rel2dir, exclude_dirs):
"""
abs2rel: absolute path to the relative location ('C:\\User\\MyUsername\\Documents\\')
rel2dir: relative path to the dict to copy ('myproject\\')
exclude_dirs: directories to exclude (['myproject\\.git','myproject\\secretfiles')
"""
os.chdir(abs2rel)
wanted_dir = lambda thisdir, exclude_dirs: not any(p in thisdir for p in exclude_dirs)
@HandcartCactus
HandcartCactus / TabPy.ipynb
Created March 22, 2021 17:48
Advanced analytics with Python in Tableau using tabpy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HandcartCactus
HandcartCactus / IrisSVC.ipynb
Created March 23, 2021 02:56
IrisSVC with TabPy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HandcartCactus
HandcartCactus / fakeoniontrain.py
Created December 4, 2021 00:39
FakeOnion train script
from transformers import GPT2Tokenizer, GPT2LMHeadModel,TrainingArguments, Trainer
import torch
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
device = 'cpu'
if torch.cuda.is_available():
device = 'cuda'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HandcartCactus
HandcartCactus / trie.py
Created July 23, 2022 07:27
Efficiently search a list of words for hamming distances of 1 using a Trie structure
import itertools as it
import random
# https://stackoverflow.com/questions/63584103/passing-a-list-of-strings-to-be-put-into-trie
class TrieNode:
def __init__(self):
self.end = False
self.children = {}
def all_words(self, prefix):
@HandcartCactus
HandcartCactus / KYE.md
Last active August 15, 2022 03:30
Unofficial "Know Your Enemy" Podcast Reading List
@HandcartCactus
HandcartCactus / tabcmd-commands
Created November 11, 2022 18:47
Starhunter -- identify tableau workbooks using a table.
tabcmd login -s <tableausiteurl> -u <username> -p <password>
tabcmd get "workbooks.xml"
@HandcartCactus
HandcartCactus / Issue.md
Created January 4, 2023 02:35
Start Menu X Broken

image As you can see from this image, on windows 10, selecting the videos tab shows the control panel items, and in fact every button on this menu appears to show what should be the submenu for the next button up. The first item, the "Desktop" button shows a blank menu that says "(empty)". I think there's some kind of 0-1 indexing issue here.