This file contains 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
#!/bin/bash | |
set -e -u -o pipefail | |
download_apk() { | |
local app_id=$1 | |
# https://github.com/EFForg/apkeep/blob/master/src/apkpure.rs#L18C54-L18C61 | |
curl -sS "https://api.pureapk.com/m/v3/cms/app_version?hl=en-US&package_name=$app_id" \ | |
-H 'x-sv: 29' \ | |
-H 'x-abis: arm64-v8a,armeabi-v7a,armeabi' \ |
This file contains 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
#!/bin/bash | |
# Search commands in history | |
set -e -u -o pipefail | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: $0 wordToMatch anotherWordToMatch -skipIfWordMatches +wordToMatchCaseSensitive ..." | |
exit 1 | |
fi | |
command="cat ~/.bash_history" |
This file contains 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
#!/bin/bash | |
set -e -u -o pipefail | |
run() { | |
for version in "$@"; do | |
local url="https://play.dhis2.org/$version/api" | |
echo "# $version" | |
curl -sS -u 'admin:district' -L "$url/events.json?event=QsAhMiZtnl2&fields=*" | jq >events.json |
This file contains 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
// ==UserScript== | |
// @name rac1-alacarta | |
// @description Add back/forward buttons to audio player | |
// @namespace https://github.com/tokland | |
// @homepage https://github.com/cvzi/rollup-userscript-template | |
// @author tokland | |
// @match https://www.rac1.cat/a-la-carta* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=rac1.cat | |
// @run-at document-start | |
// @version 0.0.1 |
This file contains 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 json | |
import requests | |
import urllib | |
from flask import Flask, Response, stream_with_context, request | |
app = Flask(__name__) | |
@app.route('/<path:url>', methods=["GET", "POST", "PUT", "DELETE"]) | |
def proxy(url): |
This file contains 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 | |
import os | |
import sys | |
from contextlib import contextmanager | |
import gi | |
gi.require_version('Gtk', '3.0') | |
gi.require_version('WebKit2', '4.0') | |
from gi.repository import Gtk, WebKit2 |
This file contains 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
type IsArray<T> = T extends unknown[] ? true : false; | |
type IsObject<T> = T extends object ? (IsArray<T> extends true ? false : true) : false; | |
type ObjectS<From, To> = { | |
[K in keyof To]: Selector<From, To[K]>; | |
}; | |
interface BaseFns<From, To> { | |
get: (from: From) => To; |
This file contains 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 _ from "lodash"; | |
import fs from "fs"; | |
import crypto from "crypto"; | |
import { Har } from "har-format"; | |
function getMd5(data: string) { | |
return crypto.createHash("md5").update(data).digest("hex"); | |
} | |
interface Request { |
This file contains 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
#!/bin/bash | |
# Like tee, but redirect both stdout and stderr to different files. | |
# | |
# Example: exec_and_tee2 file-with-stdout.txt file-with-stderr.txt find / -maxdepth 1 -type d | |
exec_and_tee2() { | |
local stdout=$1 stderr=$2 | |
shift 2 | |
{ "$@" > >(tee "$stdout"); } 2> >(tee "$stderr") | |
} |
This file contains 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 React from "react"; | |
export interface OptControlledValue<T> { | |
value?: T; | |
set?: (value: T) => void; | |
initial: T; | |
} | |
export function useMaybeControlledValue<T>(options: OptControlledValue<T>): [T, (val: T) => void] { | |
const optionsSet = options.set; |
NewerOlder