Skip to content

Instantly share code, notes, and snippets.

@vincenthsu
vincenthsu / .tmux.conf
Last active November 29, 2023 08:30
Tmux version verification (works with v1.8 to v2.1 )
# Overwrite configs depending on version
run-shell "bash ~/.tmux/verify_tmux_version.sh"
@vincenthsu
vincenthsu / 0_reuse_code.js
Created January 25, 2016 03:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vincenthsu
vincenthsu / .clang-format
Created January 12, 2016 08:31
clang-format example
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
@vincenthsu
vincenthsu / release_linux-x86_64.sh
Created January 12, 2016 08:29
build and commit to svn
#!/bin/bash
PLATFORM=linux-x86_64
BIN_LIST=(analyzer manager recorder rtsp-server vsd)
LIB_LIST=(libvs/libvs.so \
analyzer/import/linux-x86/bir_core/lib/*.so* \
analyzer/import/linux-x86/iod_core/lib/*.so* \
analyzer/import/linux-x86/IVAStreamLib/*.so*)
@vincenthsu
vincenthsu / onvif_request.py
Created January 12, 2016 08:26
ONVIF http request example
#!/usr/bin/env python3
import hashlib
import os
import base64
from datetime import datetime
username = "admin"
password = "12345"
# created = datetime.now().strftime("%Y-%m-%dT%H:%M:%S.000Z")
@vincenthsu
vincenthsu / recursive_mkdir.c
Last active January 12, 2016 08:17
recursive mkdir()
int recursive_mkdir(const char *dir, mode_t mode)
{
assert(dir && *dir);
// already exist
if (access(dir, F_OK) == 0) {
return 0;
}
size_t len;
@vincenthsu
vincenthsu / GuidConverter.cpp
Last active April 3, 2023 20:00
GUID to std::string, std::string to GUID
#ifndef _WIN32
typedef struct _GUID {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
} GUID;
#endif
GUID StringToGuid(const std::string& str)
#!/usr/bin/python
import re
import sys
found_result = "false"
#parse format:
# T:49 ( 4518) P:31 I:4243600 C: 2 Min: 8 Act: 8 Avg: 8 Max: 9
parser = re.compile("(?P<T>\d+)\D+(?P<T1>\d+)\D+(?P<P>\d+)\D+(?P<I>\d+)\D+(?P<C>\d+)\D+(?P<Min>\d+)\D+(?P<Act>\d+)\D+(?P<Avg>\d+)\D+(?P<Max>\d+)")
@vincenthsu
vincenthsu / dmesg
Created December 25, 2012 08:31
usb auto-mount faild
[ 134.430000] usb 1-1: new high speed USB device number 4 using sv887x-ehci
[ 134.460000] IAA watchdog: status 1000 cmd 10b44
[ 134.580000] scsi2 : usb-storage 1-1:1.0
[ 134.590000] $$ USB driver: usb-storage
[ 135.660000] scsi 2:0:0:0: Direct-Access SanDisk SanDisk Cruzer 8.02 PQ: 0 ANSI: 0 CCS
[ 135.680000] sd 2:0:0:0: [sda] Attached SCSI removable disk
[ 135.690000] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 135.710000] sda: detected capacity change from 8036285952 to 0