Skip to content

Instantly share code, notes, and snippets.

@languanghao
languanghao / ExcelPic.kt
Created July 8, 2024 10:05
Read excel cell embed image
package cn.crowddigital.pic.pic.service
import org.apache.commons.compress.archivers.zip.ZipFile
import org.apache.poi.ooxml.util.PackageHelper
import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import org.junit.jupiter.api.Test
import java.io.ByteArrayInputStream
import java.io.File
import java.io.InputStream
@languanghao
languanghao / documentEvent.js
Created May 29, 2020 09:04
AddApiEventListener
window.onWindowActive = () => {
};
window.onDocumentSave = () => {
};
window.onDocumentBeforeClose = () => {
};
window.onDocumentAfterClose = () => {
@languanghao
languanghao / left-bar.vue
Created December 22, 2016 06:56
element ui menu with vue-router
<template>
<el-menu :router="true" :default-active="activeLink">
<template v-for="rule in $router.options.routes">
<el-submenu v-if="rule.children && rule.children.length > 0"
:index="rule.path"
>
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template>
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item>
</el-submenu>
<el-menu-item v-else
@languanghao
languanghao / app.py
Created July 4, 2016 03:35
Seperate database model files with flask and sqlalchemy and alembic
from flask import Flask
from services.database import db
app = Flask(module_name)
db.init_app(app)
var tree = {
name : 'Root',
open : true,
children : [{
name : 'level 1',
open : false,
children : [{
name : 'level 1-1',
open : false,
}, {
def convert_sid_tostring(sid_str):
"""
将SID转换成正常的字符串,形如:S-1-5-21-3146574646-1373620345-747391786-4398
:param sid_str: AD返回的SID
:return: str
"""
sid_bytes = list(bytearray(sid_str))
sid_str = list(sid_str)
sid = 'S-%d' % sid_bytes[0]