This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from urllib.parse import urlencode | |
import json | |
# get a client_id and client_secret from Github -> Settings -> Developer -> Register New Oauth | |
# then use those and the below curl command to get an access_token | |
# curl -X POST https://api.github.com/authorizations --data '{"note": "Updater", "client_id": "XXX", "client_secret": "XXX"}' -u USERNAME --header "X-GitHub-OTP: 2FACODE" | |
ACCESS_TOKEN = "XXXX" | |
REPO = "https://switchbru.com/appstore/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run within an extracted mini game directory (one of the mg* files) | |
# recursively snips header from .lua files (.lua.ex) then runs unluac on them to be readable (.lua.ex.txt) | |
# replace /path/to/unluac.jar to an absolute path where yours is (can be built from here https://github.com/HansWessels/unluac ) | |
find . -name "*.lua" -exec sh -c 'tail -c +21 "$1" > "$1.ex"; java -jar /path/to/unluac.jar "$1.ex" > "$1.ex.txt"' x {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import anki | |
from anki.storage import Collection | |
from anki.sync import Syncer, FullSyncer, RemoteServer, HttpSyncer | |
from pathlib import Path | |
# git clone [email protected]:dae/anki.git | |
# cd anki | |
# pip3 install -r requirements.txt | |
# python3 demo.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import re | |
# regex for hiragana+katakana and a few more characters | |
blacklist = r'[ぁ-ゟ゠-ヿ「」。、 ?\n]' | |
# can be copied and pasted from the PDF including linebreaks between the two sets of """ | |
text = u"""いる | |
今日私は一日中家にいる。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from urllib.parse import urlencode | |
import json | |
print("Enter list of titles separted by a new line (or pipe into this program)") | |
while True: | |
try: | |
TITLE = input().rstrip() | |
except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL="https://dl.google.com/dl/android/aosp/ryu-opm4.171019.021.n1-factory-1f31fdce.zip" | |
TMP="tmp.zip" | |
OUT="output.zip" | |
# fetch the important "PK" region from the remote zip by specifying offsets* | |
curl --header "Range: bytes=1842-3820027" -k $URL > $TMP | |
# restore "corrupted" zip data (answer yes to question it prompts) | |
echo y | zip -FF $TMP --out $OUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Definition for a binary tree node. | |
# class TreeNode(object): | |
# def __init__(self, x): | |
# self.val = x | |
# self.left = None | |
# self.right = None | |
class Solution(object): | |
def zigzagLevelOrder(self, root): | |
# evil test case |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
あい | |
あう | |
あか | |
あし | |
あせ | |
あち | |
あっ | |
あつ | |
あと | |
あな |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
"""search for homebrew on either app store""" | |
def search(query): | |
response = urllib2.urlopen("http://switchbru.com/appstore/repo.json") | |
contents = str(response.read()) | |
packages = json.loads(contents)["packages"] | |
query = query.lower() |