Skip to content

Instantly share code, notes, and snippets.

View SamusAranX's full-sized avatar

SamusAranX

  • Germany
  • 04:39 (UTC +01:00)
View GitHub Profile
@SamusAranX
SamusAranX / termcolors.py
Created June 15, 2016 09:33
wttr.in Today widget for Pythonista 3
def get_colors():
return [(0, 0, 0), (0.9725490196078431, 0.1607843137254902, 0.2235294117647059), (0.23137254901960785, 0.9176470588235294, 0.16470588235294117), (0.984313725490196, 0.7529411764705882, 0.27450980392156865), (0.43529411764705883, 0.3058823529411765, 0.7333333333333333), (0.17647058823529413, 0.27058823529411763, 0.3843137254901961), (0.38823529411764707, 0.796078431372549, 0.8862745098039215), (0.5137254901960784, 0.5490196078431373, 0.5843137254901961), (0.27058823529411763, 0.27450980392156865, 0.25098039215686274), (0.9647058823529412, 0.1607843137254902, 0.2235294117647059), (0.23137254901960785, 0.9137254901960784, 0.16470588235294117), (0.9803921568627451, 0.7529411764705882, 0.27450980392156865), (0.43137254901960786, 0.3058823529411765, 0.7333333333333333), (0.17647058823529413, 0.27058823529411763, 0.3843137254901961), (0.3843137254901961, 0.796078431372549, 0.8862745098039215), (0.5098039215686274, 0.5450980392156862, 0.5803921568627451), (0.0, 0.0, 0.0), (0.0, 0.0, 0.2), (0.0, 0.0
@SamusAranX
SamusAranX / unpack_binarymeshdata.py
Last active March 25, 2018 03:25
This script converts .babylonbinarymeshdata files (such as the ones used in Microsoft's Xbox Design Lab) to usable .obj files.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import io
import sys
import glob
import json
import struct
import argparse
@SamusAranX
SamusAranX / GetTerminalColors.swift
Last active August 7, 2016 23:53
Run this in a Swift playground with the .terminal profile that you want to parse in the playground's Resources folder. I wrote this because I wanted to copy the colors of an OS X terminal theme to my Linux Mint terminal but couldn't find a way to list all the colors in a .terminal file.
import Cocoa
extension NSColor {
var hexString: String {
if let convertedColor = self.colorUsingColorSpaceName(NSCalibratedRGBColorSpace) {
var redFloat: CGFloat = 0.0, greenFloat: CGFloat = 0.0, blueFloat: CGFloat = 0.0
convertedColor.getRed(&redFloat, green: &greenFloat, blue: &blueFloat, alpha: nil)
// the decimals are for when the cast to Int floor()s the floats, don't worry about it
let redInt = Int(redFloat * 255.99999),
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
# usage: Put a bunch of fonts into a folder named like the font next to this script
# Do this: ./fontprofile.py "<FONT NAME>"
# There should now be a <FONT NAME>.mobileconfig file in the script's folder
# Don't pack too many fonts at once, iOS will complain if the file is too large
# The maximum file limit seems to be different on every iOS device, so YMMV
# Also, there are some font files (mostly exotic ones) that this script has problems with
# I think this is an encoding problem, but it mostly shouldn't be a problem
@SamusAranX
SamusAranX / apachelisting
Last active September 28, 2017 23:42
A little bash snippet to download Apache directory listings while circumventing robots.txt rules and simple user-agent blocks. This script also uses Python 3 to adjust the --cut-dirs value to avoid folder clutter.
function apachelisting() {
CUT_DIRS=$(python3 -c "from urllib.parse import urlparse; import sys; print(len([d for d in urlparse(sys.argv[1]).path.split('/') if d]))" "$1")
wget -r --no-parent --reject "index.html*" -e robots=off --restrict-file-names=nocontrol --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" -nH --cut-dirs="$CUT_DIRS" "$1"
}
# usage: apachelisting http://someserver.tld/ftp/a/bunch/of/folders/
# this will recursively download everything from that directory listing and cut unnecessary folders away
# for example, http://someserver.tld/ftp/a/bunch/of/folders/stuff.zip will become ./stuff.zip on your machine
# likewise, http://someserver.tld/ftp/a/bunch/of/folders/evenmorefolders/junk.rar will become ./junk.rar
@SamusAranX
SamusAranX / BARS format (to the best of my knowledge).txt
Last active August 17, 2024 22:38
BARS extractor (with improvised documentation)
IMPORTANT: All offsets are taken from KorokPot.bars! Actual offsets of dynamic-length data may vary in other files, but based
on the information here, it shouldn't be hard to find the real offsets. When in doubt, look at the code.
╒══════════╤══════════╤═════════╤════════════════════╤═══════════╤═════════════════════════╤════════════════════════════════════════════════════════════════════════╕
│ Offset │ -> Dec │ Size │ -> Dec │ Type │ Name │ Information │
╞══════════╪══════════╪═════════╪════════════════════╪═══════════╪═════════════════════════╪════════════════════════════════════════════════════════════════════════╡
│ 0x0 │ 0 │ 0x4 │ 4 │ │ BARS header │ Indicates that this is, in fact, a BARS file │
├──────────┼──────────┼─────────┼────────────────────┼───────────┼─────────────────────────┼────────────────────────────────────
@SamusAranX
SamusAranX / ytp-rgb-stretcher.css
Last active July 23, 2022 09:35
RGB Stretcher for YouTube
video.video-stream.html5-main-video {
/*transition: .5s filter ease;*/
}
body.ytp-rgb-stretcher video.video-stream.html5-main-video {
filter: url(#yt-rgb-fix);
}
@keyframes ytp-rgb-fadein {
0% { opacity: 0; }
100% { opacity: 1; }
@SamusAranX
SamusAranX / readme.md
Last active May 21, 2020 01:29
A Python script that automates some complicated aspects of ffmpeg
@SamusAranX
SamusAranX / download_emotes.py
Created October 23, 2017 21:28
Download Twitch channel emotes
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
#
# put all channels you want to download the emotes of
# into a text file called "channel_list.txt", separated
# by line breaks
# also download subscriber.json from
# https://twitchemotes.com/apidocs
# and put it into a folder called "api" next to this script
@SamusAranX
SamusAranX / ipin.py
Last active August 13, 2018 13:27
Put this into the same directory as the encoded PNG files and execute the script.
#---
# iPIN - iPhone PNG Images Normalizer v1.0
# Copyright (C) 2007
#
# Author:
# Axel E. Brzostowski
# http://axelbrz.com/
# [email protected]
#
# References: