Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Working

渣渣辉 T-Oner

🐢
Working
View GitHub Profile
@T-Oner
T-Oner / commit-msg
Last active Oct 13, 2020
迫于公司提交代码要求越来越繁琐,而且还是人肉写 txt,经常有错别字,特此写一个 git 自动化脚本,生成 test_focus
View commit-msg
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
@T-Oner
T-Oner / fork.c
Last active May 8, 2020
fork.c 是测试 fork 后子进程是从 main 开始走,还是从 fork 处开始走。orphan_process.c 是测试孤儿进程的。
View fork.c
#include <stdio.h>
int main() {
printf("main\n");
int pid = fork();
printf("%d\n", pid);
}
View alloc_pid.java
public class Main {
static int last = -1;
static int pids;
static int usedPid = 0;
public static void main(String[] args) {
System.out.println(allocPid());
System.out.println(allocPid());
System.out.println(allocPid());
System.out.println(allocPid());
// 释放 pid 为 3 的程序
View docker-compose.yml
version: '3.7'
services:
mysql:
image: mysql
container_name: mysql
restart: always
ports:
- 3306:3306
volumes:
- /opt/mysql/data:/var/lib/mysql
View php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@T-Oner
T-Oner / EncodingDetect.java
Created Aug 19, 2019 — forked from willonboy/EncodingDetect.java
Java版自动获取文本文件使用的编码
View EncodingDetect.java
package com.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
@T-Oner
T-Oner / commute.py
Created Jul 16, 2019
Record commute date into AirTable
View commute.py
import datetime
import requests
import json
import time
server_url = 'https://api.airtable.com/v0/appvxd9mJOEwsM56A/Commute/'
app_key = 'YOUR AIRTABLE APP KEY'
headers = {