Skip to content

Instantly share code, notes, and snippets.

View kcchien's full-sized avatar

Kuang-Cheng Chien kcchien

  • King Steel Machinery Co., Ltd.
  • Taichung, Taiwan
View GitHub Profile
@kcchien
kcchien / nteract-tricks.md
Created August 8, 2020 04:52 — forked from vhoulbreque/nteract-tricks.md
Make conda environments visible in nteract

Nteract tricks

To add a conda environment to the list of environments:

$ source activate thisenv
(thisenv) $ pip install ipykernel
(thisenv) $ python -m ipykernel install --user --name thisenv
@kcchien
kcchien / zpl-tcp.js
Last active October 11, 2023 21:38 — forked from gourneau/zpl-tcp.py
Printing ZPL over TCP/IP Example Python , Node.js 如何透過TCP/IP 直接送出ZPL檔到條碼機列印
const net = require('net'); // 引入網路 (Net) 模組
const HOST = '10.10.10.168';
const PORT = 9100;
let zpl = `
^XA
^FO150,40^BY3
^BCN,110,Y,N,N
^FD123456^FS
^XZ
@kcchien
kcchien / miniconda_on_rpi.md
Last active October 29, 2018 06:49 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi 在樹莓派上安裝 Miniconda
@kcchien
kcchien / parseMustache.coffee
Created August 10, 2018 07:52 — forked from lucasmotta/parseMustache.coffee
A simple function to parse strings with {{mustache}} tags and replace its dot notation string to a given object path.
parseMustache = (str, obj) ->
str.replace /{{\s*([\w\.]+)\s*}}/g, (tag, match) ->
nodes = match.split(".")
current = obj
for node in nodes
try
current = current[node]
catch
return ""
current
@kcchien
kcchien / cpm.js
Created August 4, 2018 06:17 — forked from perico/cpm.js
Critical Path Method Implementation Javascript
/**
* Implementation of the Critical Path Method (CPM) with variation
* @see http://en.wikipedia.org/wiki/Critical_path_method
*
* Shows all the critical Paths, returns a subset of the graph
* containing the critical activities
*/
/**
* Activity Class
@kcchien
kcchien / difference.js
Created June 28, 2018 07:28 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@kcchien
kcchien / npm-exec.bat
Created June 5, 2017 08:43 — forked from joeyespo/npm-exec.bat
Execute a node_modules/.bin script on Windows.
@ECHO OFF
SETLOCAL
REM Speed up by checking for bin directory directly
IF NOT EXIST node_modules\.bin GOTO FINDBIN
SET BIN=.\node_modules\.bin
GOTO RUN
:FINDBIN
REM Find the current bin directory from npm, storing the result in 'BIN'
@kcchien
kcchien / iterm2-solarized.md
Created June 2, 2017 12:01 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@kcchien
kcchien / 0_reuse_code.js
Created February 21, 2017 13:05
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