Skip to content

Instantly share code, notes, and snippets.

View RammusXu's full-sized avatar

RammusXu RammusXu

View GitHub Profile
@RammusXu
RammusXu / 2021-01-07
Created January 7, 2021 07:23
Github Action Machine resource
lscpu
shell: /bin/bash -e {0}
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
@RammusXu
RammusXu / github-api-update-file.sh
Last active November 28, 2024 20:44
Github REST API update file with commit
REPO=rammus/action-demo
FILE=README.md
INPUT_GITHUB_TOKEN=
# https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#get-repository-content
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $INPUT_GITHUB_TOKEN" \
"https://api.github.com/repos/${REPO}/contents/${FILE}"
@RammusXu
RammusXu / bump-docker-buildx.sh
Last active September 2, 2020 03:42
Upgrade buildx version on Mac
docker buildx version
mkdir -p ~/.docker/cli-plugins
BUILDX_VERSION="v0.4.2"
wget https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.darwin-amd64 -O ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
docker buildx version
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, Rammus Xu!'
kind: Service
apiVersion: v1
metadata:
name: telepresence-rammus
spec:
selector:
owner: rammus
type: LoadBalancer
ports:
- name: http
version: "2"
services:
overworld:
image: dstacademy/dontstarvetogether
container_name: overworld
hostname: overworld
tty: true
stdin_open: true
command: dst-server start --update=all
env_file: ./overworld.env
@RammusXu
RammusXu / demo.js
Last active May 6, 2016 02:36
variable changed by other, but I just want to get a clone of it
var mo = require('./module')();
console.log(mo);
var who = mo.A;
console.log(who);
who.name ='wal2er';
console.log(who);
console.log(mo);
@RammusXu
RammusXu / promise
Created April 29, 2016 07:48
how to refactor it ?
var request = [
profileUtil.createUser('[email protected]', 'qwer1234', 'test', 'Company'),
profileUtil.createUser('[email protected]', 'qwer1234', 'test2', 'Company'),
];
request[0].then(function(value) {
return request[1];
})
.then(function(value) {
return request[2];
@RammusXu
RammusXu / base.py
Last active March 19, 2021 14:06
Python Parser
import xml.etree.ElementTree as ET
tree = ET.parse("arrays.xml")
ET.dump(tree)
tree.write("new_strins.xml")
class BrowseController < ApplicationController
def index
path = "public/apk_pool/"+ params[:folder] +"/*"
@apks = Dir.glob(path)
@apks.each do |apk|
puts apk
end
end
def show