Skip to content

Instantly share code, notes, and snippets.

@gxm11
gxm11 / main.rb
Last active December 18, 2021 09:16
find rules(小学奥数)
module HappyMath
class FullPermutationRepeat
include Enumerable
def initialize(args, n)
@args = args
@n = n
end
def each(&b)
@gxm11
gxm11 / main.py
Last active April 18, 2021 05:26
battleship game with mist
# ship battle game
# 1. ships can generate a detect value to every block nearby, v = 1 / (dx * dx + dy * dy)
# 2. the sea has its own detect limit, which will decrease slightly
# 3. attack will add a temp detect value to 3x3 blocks
# 4. any block where detect value * 2 + temp value > sum(detect value) + detect limit will be visible
import numpy as np
import re
import string
import sys
@gxm11
gxm11 / main.py
Last active March 26, 2021 08:28
Another BattleShip Game
import numpy as np
import string
import re
class ShipGame:
def __init__(self, width, height):
self.width = width
self.height = height
@gxm11
gxm11 / run.sh
Last active June 11, 2020 07:55
run gogs on sae docker virtual machine...
# for alpine 3.8
apk add --no-cache gogs bash
cd /usr/bin
ln -s /usr/share/webapps/gogs/templates templates
ln -s /usr/share/webapps/gogs/public public
mkdir custom
mkdir custom/conf
chmod -R 777 custom templates public
adduser -D git
cat > /etc/Procfile <<EOF