Skip to content

Instantly share code, notes, and snippets.

View Artoria2e5's full-sized avatar
🌪️
not focusing!

Mingye Wang Artoria2e5

🌪️
not focusing!
View GitHub Profile
@Artoria2e5
Artoria2e5 / ds_trans.md
Last active August 29, 2015 14:26
Don't Starve (Together) Translator internals and mod API

Translator

The Translator class, located in data/scripts/translator.lua, provides a Gettext-based translator system. It also provides a variable LanguageTranslator of this type.

The functions, unless specicially stated, are class functions.

Don't Starve uses a custom and simplified Gettext parser and thus may not work as expected with gettext editors like POedit and Emacs. It only escapes \n, \r and ". Not even \ is escaped, causing problems when you want a literal \n (luckily the need for it would be quite rare unless someone is writing a programming tutorials mod or so.)

开放言论的“言论”:中国瞄准了它的码农

August 28, 2015 | By Danny O'Brien | Translations should go anonymous without credit:
NoteHub, Gist

电子前哨基金会原文:Speech that Enables Speech: China Takes Aim at Its CodersEFF Copyright Info (CC-BY)

GoAgent,中国最流行的审查规避工具之一的作者在星期二清空了这个项目的主要源码库。项目的开发者 Phus Lu 将这个版本库的描述改为了“Everything that has a beginning has an end”(有始必有终)。Phus Lu 的 Twitter 账号历史也被清空,只留一条指向索尔仁尼琴(Alexander Solzhenitsyn)《不靠谎言而活》(Live Not By Lies)的推文。这篇文章最早发表在 1974 年

@Artoria2e5
Artoria2e5 / fbi_warning.bash
Last active November 12, 2015 07:47 — forked from 1a57danc3/FBI WARNING SSH NOTIFICATION.SH
fbi_warning_rc.bash
#!/bin/bash
# Add this to your bashrc. May work in other shells.
# For POSIX Portability, apply github.com/koalaman/shellcheck/wiki/SC2039
# Find out current screen width, if COLUMNS is absent
[ "$COLUMNS" ] || COLUMNS=$(tput cols || echo 80) _fbi_resetcol=1
_FBI_MESSAGE="Federal Law provides severe civil and criminal penalties \
for the unauthorized reproduction, distribution, or exhibition of \
copyrighted motion pictures (Title 17, United States Code, Sections \
501 and 508). The Federal Bureau of Investigation investigates \
allegations of criminal copyright infringement"
#!/bin/bash
feistel(){
declare -i i l="$1" r="$2" t magic=225052
for ((i=0; i<16; i++)); do
printf '0x%08x,\t' "$i" "$magic" "$(( (magic + 8) & 31))" "$(( ((magic + r) << 8) & 0xFFFFFFFF ))" "$(( (magic * (b+4)) & 0xFFFFFFFF))" "$(( (26172 * r) & 0xFFFFFFFF))" "$a"
echo
t=r
l=l
r=t
# round function
@Artoria2e5
Artoria2e5 / UL238582_linky.bash
Last active February 3, 2016 12:45
All those SE trash
#!/bin/bash
((!EUID)) || exec sudo "$0" "$@" # Addicted to OR-logic
declare -A src_dst_pair src_dst_old; # dictionaries -- the older one not being used
oops(){ printf '%b\n' "oOpsS!\t$1">&2; exit "${2:-1}"; }
## oldlist file
## Gets the contents of a legacy list.
oldlist() {
local arr i s d;
awk '/^#BEGIN-log#/ {flag=1; next} /^#END-log#/ {flag=0} flag' "$1" | mapfile arr
@Artoria2e5
Artoria2e5 / Explanation.md
Last active December 8, 2015 18:14
Mikeserv's script

Explanation

Here is a reformatted version of the script:

(                                           # start a subshell to isolate env changes
IFS=/                                       # split on /
set -- /Dropbox/apache2-backup*             # set arg array to last glob, and:
set -ef # EXPANDED # turn off globbing (-f) and die on errors (-e)
@Artoria2e5
Artoria2e5 / Foo.md
Created October 30, 2015 01:58
GNU Manifesto vs. Emacs Doctor

I am the psychotherapist. Please, describe your problems. Each time you are finished talking, type RET once or click 'say'.

What's GNU? Gnu's Not Unix!

Why do you say what's gnu gnu's not unix!?

GNU, which stands for Gnu's Not Unix, is the name for the complete Unix-compatible software system which I am writing so that I can give it away free to everyone who can use it.(1) Several other volunteers are helping me.

Do you really think that?

@Artoria2e5
Artoria2e5 / config.js
Last active February 8, 2016 10:13
tg2ircbot
exports = {
// not impl'ing tg multiacc now
telegram: {
// apikey: botcfg
'foobar': {
groups: {
// grpid : grpcfg
'23333': {
outfilter: (s) => s.replace('nangcr','南瓜超人'),
infilter : (s) => s.replace('phoenixlzx', '[who must not be named]')
@Artoria2e5
Artoria2e5 / Progress.md
Last active February 19, 2016 21:23
wx, gtk, and ~~perhaps~~ certainly more

I don't know if it works. Perhaps I should try Hyper-V'ing ArchLinux?

  • We should use the big full wxWidget tarball
  • We should make everything in one PKGBUILD, so qt, gtk2/3, xft...
  • fill in the blanks
    • some makedepends
    • all these packages should 'provide' to a virtual package called wxWidgets or so
    • some pkgdep
      • wxbase =-synced version
  • pkgdesc
@Artoria2e5
Artoria2e5 / white-albot.py
Last active March 7, 2016 05:25
white-album bot
from __future__ import division, print_function, unicode_literals
import random
import string
import pangu
import re
def w_expand(lst):
return sum([a[1] for i in range(a[0])] for a in lst)
sentences = w_expand([