Skip to content

Instantly share code, notes, and snippets.

View asyncins's full-sized avatar

穿甲兵技术社区 asyncins

View GitHub Profile
@asyncins
asyncins / docker_push.md
Created August 29, 2021 14:49
[docker cloud]

docker tag 882db3a24154 registry.cn-hangzhou.aliyuncs.com/wqzcir/circles:v1.0.0

@asyncins
asyncins / hook_window_property.script
Created July 7, 2020 13:02
[hook window property]
(function() {
'use strict';
var t = window.xxxxx // 指定 window 对象
Object.defineProperty(window, 'xxxxx', {
get: function(){
console.log("Get window property");
return t;
},
set: function(val){
@asyncins
asyncins / signly_linked_reverse.py
Last active July 5, 2020 12:18
[算法-单链表反转]
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
prev = None
current = head
@asyncins
asyncins / treenode_pre_in_post_solution.py
Created July 5, 2020 05:05
[算法-二叉树前中后序遍历]
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
# 二叉树前中后序遍历
class Solution:
def __init__(self):
self.traverse = []
# 前序遍历组合
@asyncins
asyncins / movezero.py
Created July 5, 2020 03:46
[算法-移动零]
# 将零移动到末尾,要求在原数组操作且尽可能减少操作次数
source = [0, 3, 5, 0, 2, 1, 0, 9]
def solution(source):
j = 0
for k, i in enumerate(source):
if i != 0:
source[j], source[k] = i, 0
j += 1
return source
@asyncins
asyncins / snowflake.go
Created July 3, 2020 05:59
[snowflake-go]
package main
import (
"errors"
"fmt"
"sync"
"time"
)
const (
@asyncins
asyncins / gitlab_runner_docker.md
Last active June 30, 2020 16:35
[GitLab Runner Docker]

在 docker 里安装 gitlab runner,并将 runner 注册到 gitlab 中

gitlab-runner register \
  --non-interactive \
  --executor "docker" \
  --docker-image alpine:latest \
  --url "http://121.36.22.204/" \
 --registration-token "zHkqsD2ffFHNioqkG5r4" \
@asyncins
asyncins / go-array-equal.go
Created June 24, 2020 03:03
[Golang 两个数组是否完全相等]
/* 判断两个数组是否相同 */
func ArrayEqual(a, b []string) bool {
if (a == nil) != (b == nil) {
return false
}
if len(a) != len(b) {
return false
}
@asyncins
asyncins / ubuntu-backup-recover.md
Created April 14, 2020 09:49
[ubuntu 备份和恢复]

backup:

$ sudo su

$ cd /

$ tar cvpzf backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/sys /

根目录生成的 backup.tgz 就是备份结果

@asyncins
asyncins / ubuntu-desktop-icon.md
Created April 14, 2020 09:00
[Ubuntu Desktop Icon] 为应用添加图标

sudo nano /usr/share/applications/Pycharm.desktop

[Desktop Entry]
Name=Pycharm
Comment=Pycharm:The Python IDE
Exec=/usr/lib/pycharm-community/bin/pycharm.sh
Icon=/usr/lib/pycharm-community/bin/pycharm.png
Terminal=false
Type=Application