Skip to content

Instantly share code, notes, and snippets.

@Transfusion
Transfusion / append.js
Created August 16, 2015 01:39
Concatenating files together in node.js
// equivalent to cat filechunk.1 filechunk.2 ... > output.file
var fs = require('fs');
var path = require('path');
var fileName = "output.file";
var concatFile = function(){
// var numberOfChunks = Math.max(Math.floor(totalSize/(chunkSize*1.0)), 1);
var numberOfChunks = 7;
var w = fs.createWriteStream(path.join('./', fileName));
var chunkNumber = 1;
public static int secondLargest(int[] arr, Map<Integer, Integer> b){
/*if (arr.length == 1){
return arr[0];
}*/
printArr(arr);
if (arr.length == 2){
int f, g;
if (arr[0] >= arr[1]){
f = arr[0];
g = arr[1];
import cv2
import numpy as np
import os
import sys
import cPickle as pickle
import shelve
import itertools
import gc
import time
@Transfusion
Transfusion / output.txt
Created April 28, 2016 03:18
Benchmark of InstaSketch's algolib db_populate.py
53021317 function calls (46373163 primitive calls) in 396.480 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 396.481 396.481 <string>:1(<module>)
1 9.673 9.673 266.667 266.667 BoW_descriptor.py:15(compute_vocabulary)
1000 2.627 0.003 79.492 0.079 BoW_descriptor.py:31(describe)
1000 0.039 0.000 3.691 0.004 color_descriptor.py:12(describe)
5000 0.018 0.000 0.643 0.000 color_descriptor.py:56(histogram)
@Transfusion
Transfusion / # python - 2017-05-19_09-53-18.txt
Created May 19, 2017 02:00
python on macOS 10.12 - Homebrew build logs
Homebrew build logs for python on macOS 10.12
Build date: 2017-05-19 09:53:18
@Transfusion
Transfusion / 教程.md
Last active March 8, 2021 15:09
drrr.com 定期报时

先打开浏览器 Console。浏览器哪JS方案自动报时需要以下四点:

  1. 怎么获取现在时间, 转化成自己想要的格式

    很容易,创建 var d = Date() 对象, 然后使用 getMonth(), getFullYear() 等方法获取月,年,小时,等

    (参考 https://www.w3schools.com/js/js_date_methods.asp )

@Transfusion
Transfusion / infoviz.user.js
Created August 3, 2018 08:27
InfoViz Display Nav Injected JS
// ==UserScript==
// @name Petronas InfoViz navigation script
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Demonstration of adding unique URL to a dynamic javascript page
// @author [email protected]
// @match http://10.14.160.41/viz*
// @grant none
// ==/UserScript==
@Transfusion
Transfusion / build.sh
Created September 29, 2018 00:03
Shell script to build TesseractOCR.framework from source
git clone https://github.com/gali8/Tesseract-OCR-iOS.git
rm -Rf Tesseract-OCR-iOS/build
xcodebuild archive -project Tesseract-OCR-iOS/Tesseract\ OCR\ iOS.xcodeproj -scheme TesseractOCR -sdk iphoneos SYMROOT=build
xcodebuild build -project Tesseract-OCR-iOS/Tesseract\ OCR\ iOS.xcodeproj -target TesseractOCR -sdk iphonesimulator SYMROOT=build
cp -RL Tesseract-OCR-iOS/build/Release-iphoneos Tesseract-OCR-iOS/build/Release-universal/
cp -RL Tesseract-OCR-iOS/build/Release-iphonesimulator Tesseract-OCR-iOS/build/Release-universal/
lipo -create Tesseract-OCR-iOS/build/Release-iphoneos/TesseractOCR.framework/TesseractOCR Tesseract-OCR-iOS/build/Release-iphonesimulator/TesseractOCR.framework/TesseractOCR -output Tesseract-OCR-iOS/build/Release-universal/TesseractOCR.framework/TesseractOCR
cp -r Tesseract-OCR-iOS/build/Release-universal/TesseractOCR.framework .
@Transfusion
Transfusion / tree_structure.txt
Created October 1, 2018 09:30
File structure of Rhomobile integration with Tesseract
.
├── app
│ ├── GreetingTest
│ ├── OCRPoCExtTest
│ ├── Settings
│ └── helpers
├── bin
│ └── tmp
├── extensions
│ ├── OCRPoCExt
@Transfusion
Transfusion / tree_structure_ocr_ext.txt
Created October 4, 2018 00:58
Tree structure of the extension directory
/Users/transfusion/workspace/SampleRhoApp/extensions
├── OCRPoCExt
│ ├── ext
│ │ ├── OCRPoCExt.xml
│ │ ├── build
│ │ ├── build.bat
│ │ ├── platform
│ │ │ ├── android
│ │ │ │ ├── Rakefile
│ │ │ │ ├── ext_java.files