Skip to content

Instantly share code, notes, and snippets.

View Gizeta's full-sized avatar
:electron:
😇

Gizeta Gizeta

:electron:
😇
View GitHub Profile
@Gizeta
Gizeta / array2reg.js
Created April 24, 2025 04:51
generate regex from array
(function it(o) {
const l = Object.keys(o.n).length;
if (l === 0) return o.c;
if (l === 1) return `${o.c||''}${Object.keys(o.n).map(x => it(o.n[x])).join('|')}`;
return `${o.c||''}(${Object.keys(o.n).map(x => it(o.n[x])).join('|')})`;
})(["123", "124", "abc"].reduce((o, s) => {
s.split('').reduce((oo, c) => {
oo.n[c] ||= { c, n: {} };
return oo.n[c];
}, o);
@Gizeta
Gizeta / 💻 Recent coding in languages
Last active September 2, 2025 00:19
💻 Recent coding in languages
JSON +955/ -0 █████████████████████100.0%
@Gizeta
Gizeta / Gizeta's GitHub Stats
Last active March 14, 2025 00:17
My GitHub Stats
⭐ Total Stars: 75
➕ Total Commits: 3,129
🔀 Total PRs: 25
🚩 Total Issues: 88
📦 Contributed to: 4
@Gizeta
Gizeta / gist:a07fdbd3702028e559da6d0fbcf0b23b
Created March 21, 2020 10:54
online_video_codec_transform.js
const axios = require('axios');
const ffmpeg = require('fluent-ffmpeg');
const http = require('http');
const server = http.createServer((req, resp) => {
const parts = req.url.split('?');
const url = parts.slice(1).join('?');
axios({
method: 'get',
url,
@Gizeta
Gizeta / to_echart.js
Created June 19, 2019 11:20
Convert to Echart option
let data = require('./data.json');
data = data.filter(d =>
d.timestamp > +new Date(2019,5,17,0) && d.timestamp < +new Date(2019,5,18,0)).sort((d1, d2) => d1.timestamp - d2.timestamp);
const json = {
title: { text: 'mem usage' },
tooltip: { trigger: 'axis' },
legend: { data: null },
xAxis: {
type: 'category',
@Gizeta
Gizeta / export.py
Created November 12, 2018 09:51
Generate docx document for MySQL DataTables
# -*- coding: utf-8 -*-
import mysql.connector
from docx import Document
db = 'lanyun'
host = 'localhost'
user = 'root'
password = 'lanyun'
port = 3306
/*
* // USAGE
* interface TestEvent {
* pass_string: string;
* pass_number: number;
* not_pass: void;
* }
*
* class TestClass extends EventEmitter {}
* const test: StrictEventEmitter<EventEmitter, TestEvent> = new TestClass();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<textarea id="input"></textarea>
@Gizeta
Gizeta / convert_id.sql
Created April 28, 2017 06:07
poi-statistics convert enemy id
CREATE OR REPLACE FUNCTION convert_id() RETURNS void AS $$
DECLARE
len integer DEFAULT 0;
t integer DEFAULT 0;
num integer DEFAULT 0;
i integer DEFAULT 0;
e varchar(70) DEFAULT '';
result varchar(70) DEFAULT '';
cur CURSOR FOR SELECT id, enemy FROM drop_records;
BEGIN
@Gizeta
Gizeta / bupt-xuanke.rb
Last active September 19, 2016 06:28
bupt-xuanke
require 'net/http'
require 'timeout'
require 'cgi'
$username = 'xxxxxx'
$password = 'xxxxxx'
$classes = [
{
'id' => '3311100933',
'name' => '研究生英语科技写作',