Skip to content

Instantly share code, notes, and snippets.

View hexylena's full-sized avatar
🏳️‍⚧️
Generally Unavailable

Helena hexylena

🏳️‍⚧️
Generally Unavailable
View GitHub Profile
@hexylena
hexylena / test.xml
Created October 15, 2024 09:34
testing tool(s) for galaxy
<?xml version="1.0"?>
<tool id="metadataFetch" name="Metadata" version="1.0" profile="16.04">
<description></description>
<command detect_errors="aggressive"><![CDATA[
echo "==tags==" >> $output;
#for tag in $input.tags:
echo "${tag.user_tname}" >> $output;
#end for
@hexylena
hexylena / cite.py
Last active May 6, 2024 11:12
Replace \cite{10.1234/some-key} with actual citation, doi2bib must be installed.
#!/usr/bin/env python
# license: cc0/public domain
import re
import sys
import subprocess
input_file = sys.argv[1]
output_file = input_file.replace('.tex', '.bib')
with open(input_file, "r") as f:
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
title,rating,runtime,imdb_rating,meta_score,genre,release_year,description,director,stars,votes,gross,img_src,type
Love Actually,R,135,7.6,55,"Comedy, Drama, Romance",2003,"Follows the lives of eight very different couples in dealing with their love lives in various loosely interrelated tales all set during a frantic month before Christmas in London, England.",Richard Curtis,"Hugh Grant, Martine McCutcheon, Liam Neeson, Laura Linney, ","517,283",$59.70M,"https://m.media-amazon.com/images/M/MV5BNThkNjgxNGQtOTIxMy00ZTFmLWIwMDItYzE5YzM3ZDMzNDE3XkEyXkFqcGdeQXVyMTUyNjc3NDQ4._V1_UY209_CR3,0,140,209_AL_.jpg",Movie
Home Alone,PG,103,7.7,63,"Comedy, Family",1990,"An eight-year-old troublemaker, mistakenly left home alone, must defend his home against a pair of burglars on Christmas Eve.",Chris Columbus,"Macaulay Culkin, Joe Pesci, Daniel Stern, John Heard, ","629,713",$285.76M,"https://m.media-amazon.com/images/M/MV5BMzFkM2YwOTQtYzk2Mi00N2VlLWE3NTItN2YwNDg1YmY0ZDNmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UY209_CR0,0,140,209_A
@hexylena
hexylena / Discover.py
Last active June 16, 2023 14:17
Autodiscover available functions based on docstrings and type annotations
def discover(self):
import inspect
TYPES = {
str: "string",
int: "integer",
}
functions = []
discovered = [x for x in inspect.getmembers(self) if not x[0].startswith('_') and x[0] != 'discover']
for (fn_name, fn) in discovered:
@hexylena
hexylena / logged-in.js
Created April 21, 2022 11:11
Testing logins with playwright to automate Galaxy things
const { chromium } = require('playwright-chromium');
const fs = require('fs');
(async () => {
const browser = await chromium.launch();
var contextOptions = {
ignoreHTTPSErrors: true,
}
fs.stat("state.json", (err, stats) => {
#!/usr/bin/env python
# Author: Helena Rasche
# License: AGPL-3.0
import json
import requests
import yaml
import subprocess
with open('requirements.yml', 'r') as handle:
@hexylena
hexylena / clean-deps.py
Created November 18, 2021 16:31
Cleanup ansible roles that don't match the expected version
import yaml
import subprocess
with open('requirements.yml', 'r') as handle:
desired = yaml.load(handle)
desired = {x.get('name', x['src']): x['version'] for x in desired}
if any([isinstance(v, int) or isinstance(v, float) for v in desired.values()]):
raise Exception("One of your values is a float! Please make it a string in the yaml file.")
@hexylena
hexylena / test.tf
Created September 29, 2021 08:31
example copying iam secrets to github
provider "github" {
owner = "hexylena"
}
resource "github_actions_secret" "repo-name-ses-key" {
repository = "repo-name"
secret_name = "SES_ACCESS_KEY"
plaintext_value = "${aws_iam_access_key.amazon-ses.id}"
}
resource "github_actions_secret" "repo-name-ses-secret" {
@hexylena
hexylena / tn.sh
Created August 6, 2021 18:18
Make spawning tmux sessions fun again
hash_string256() {
hash_value=$(printf "%s" "$1" | md5sum |tr -d " -"| tr "a-f" "A-F")
printf "ibase=16; (%s + %X) %% 100 \n" $hash_value "$2" | bc
}
declare -a light
light=(2 3 4 6 7 10 11 12 13 14 15 33 39 41 42 43 44 45 46 47 48 49 50 51 68 69 70 71 72 73 74 5 76 77 78 79 80 81 82 83 84 85 86 87 101 102 103 104 105 106 107 108 109 110 111 12 113 114 115 116 117 118 119 120 121 122 123 134 135 136 137 138 139 140 141 142 143 144 145 46 147 148 149 150 151 152 153 154 155 156 157 158 159 167 168 169 170 171 172 173 174 175 176 77 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 201 202 203 204 205 206 07 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 31 245 246 247 248 249 250 251 252 253 254 255)
if [[ "$1" != "" ]]; then
WITH
sent
AS (
SELECT
job.id AS job,
date_trunc('month', job.create_time)::DATE AS month,
job.job_runner_name AS runner,
ds_in.total_size AS size
FROM
job