Skip to content

Instantly share code, notes, and snippets.

Avatar
💊
testing titty tablets

Mingye Wang Artoria2e5

💊
testing titty tablets
View GitHub Profile
View gist:1f63fe5826f6786d268edf035706a0ea
objc_alloc=func
func.objc_alloc.args=1
func.objc_alloc.args.0=void*,id
func.objc_alloc.ret=void
objc_autorelease=func
func.objc_autorelease.args=1
func.objc_autorelease.args.0=void*,id
func.objc_autorelease.ret=void*
@Artoria2e5
Artoria2e5 / sun_getopt.c
Last active Oct 5, 2020
getopt(3) in the Solaris way, as a wrapper around getopt_long(3)
View sun_getopt.c
/**
* sun_getopt - Solaris-style getopt(3), as a wrapper around getopt_long(3).
*
* Written by Mingye Wang (Artoria2e5). Dedicated to the public domain under
* Creative Commons Zero.
*
* Untested. Like not even fed to a compiler once.
*/
#include "sun_getopt.h"
@Artoria2e5
Artoria2e5 / duplicate-minecraft-dir.sh
Last active Jul 4, 2020
Copy a minecraft directory with some symlinks
View duplicate-minecraft-dir.sh
#!/bin/bash
# duplicate-minecraft-dir: copies a minecraft directory with some symlinks.
# Requires uname and GNU coreutils.
# Requires admin priv under Windows.
# Dedicated to the public domain under Creative Commons Zero. Do what the heck you wanna do with it.
SELF=$0
die(){ printf '%s: %s\n' "$SELF" "$1">&2; exit "${2-2}"; }
log() { local level=$1; if ((VERBOSE >= level)); then printf '%s: %s\n' "$SELF" "$2">&2; fi; }
nolink=(config options\*.txt launcher_profiles.json servers.dat config baritone Impact mods)
@Artoria2e5
Artoria2e5 / run_as_admin.vbs
Created Mar 18, 2020
Proxy script for running anything as an admin. Contains an CommandLineToArgvW escaper.
View run_as_admin.vbs
' Proxy script for running anything as an admin. In this case, AHK.
Set UAC = CreateObject("Shell.Application")
Dim Arguments
' Build arguments
Arguments = ""
For Each strArg in WScript.Arguments
Arguments = Arguments & Escape(strArg) & " "
Next
UAC.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", Arguments, "", "runas", 1
View nevertested.cc
#include <iostream>
#include <cstdint>
template<typename T>
class MerssenePerfect {
// A000043
static_assert(std::is_unsigned<T>::value,
"MerssenePerfect should use an unsigned type");
const static int_fast8_t primes[18] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61 };
ptrdiff_t offset;
View CurlyFakePolyp.cpp
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
@Artoria2e5
Artoria2e5 / pref.json
Created Sep 19, 2017
vscode settings, zh-cn
View pref.json
{
"workbench.colorTheme": "Default Light+",
"editor.fontFamily": "'Inziu Iosevka SC', monospace",
"editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?《》?!()。【】;:“”‘’"
}
@Artoria2e5
Artoria2e5 / seeborg_zh.md
Last active Jul 4, 2017
quick notes for seeborg@zh
View seeborg_zh.md

Adapting seeborg for Chinese

See https://github.com/hmage/seeborg/issues/25. We need to chew the received message for seeborg so it can properly assimilate it.

Inject the nanoprobes here, right?

Seeborg chews messages and tries to reply to it in SeeBorg::Reply. This applies to both the IRC and the console versions, so that should be deemed a good enough place to start with.

@Artoria2e5
Artoria2e5 / devise.zh-CN.yml
Last active Aug 30, 2019
Devise 4.2.6 zh files
View devise.zh-CN.yml
# Chinese (China) translations for Devise 4.2.1
# 4.2.0: By HealthGrid at https://gist.github.com/HealthGrid/2d702b38aa6ffe0233f27d3d5be9250f
# 4.2.1: By Artoria2e5 (this file)
# - Fixes pluralization problems (zh only takes "other")
# - Misc translation improvements, you know what these grammar things are.
# - Should be minor enough to claim CC0 for my changes.
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
zh-CN:
devise:
@Artoria2e5
Artoria2e5 / bd_mercator.js
Last active Feb 12, 2017
Baidu's Twist on Web Mercator (as shown at https://github.com/GeeBar/coord/pull/3)
View bd_mercator.js
// Reference value:
// http://lbsyun.baidu.com/index.php?title=webapi/guide/changeposition
// type 5 (lon,lat) -> type 6 (x,y)
// js source, presumably same as ref?
// https://github.com/GeeBar/coord/blob/master/mercator.js
var BD_EXTENT_LON = 20037726.372144807 // ? - lon only; lat goes less
var BD_EXTENT_LAT = 12474104.1741418
// Their js truncated at 74, but included taylor terms up to 75~90 (82.5).
// These terms are severly screwed thanks to their misunderstanding of taylor.
You can’t perform that action at this time.