Skip to content

Instantly share code, notes, and snippets.

View jwt625's full-sized avatar
🐢
Alive

Wentao jwt625

🐢
Alive
  • Flux Photonics
  • Pacifica, CA
  • 16:03 (UTC -07:00)
View GitHub Profile
@jwt625
jwt625 / tif2png.m
Created January 27, 2024 04:11
convert tif to png in matlab
% Get a list of all TIF files in the current folder
tifFiles = dir('*.tif');
% Loop through each TIF file
for i = 1:length(tifFiles)
% Read the TIF file
tifFileName = tifFiles(i).name;
tifData = imread(tifFileName);
% Convert to PNG
@jwt625
jwt625 / calc_area.lym
Created March 30, 2023 22:51 — forked from g2hollow/calc_area.lym
klayout macro qt area calculator
import pya
class AreaCalculator(pya.QDialog):
"""
This class implements a dialog for calculating area of shapes
in a layout. The calculator adds up shapes in the currently
selected cell and below.
"""
def button_clicked(self, checked):
@jwt625
jwt625 / keybindings.json
Created July 16, 2020 05:33
key bindings for vs code
// Place your key bindings in this file to override the defaults
[
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" },
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" },
]
%YAML 1.2
---
# JEOL jdf & sdf file syntax highlight for sublime
# WTJ, 20180316
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- jdf
- sdf
scope: source.example-c
@jwt625
jwt625 / rpn.m
Last active January 15, 2018 20:25
simple matlab rpn calculator
function rpn
% simple rpn (Reverse Polish notation) calculator
%
% WTJ
% 20180113
fprintf(['Reverse Polish notation calculator. Type h or help to see available functions.'...
'\n\tWentao Jiang, 20180113\n']);
stack = NaN(10000);
ind = 1;
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 4 20:02:31 2018
@author: linqs-wentao
"""
class fiberpull:
def __init__(self, ctrlraddr, d0_fiber=2, d_fiber=1, t_heat=10):
cpp-5 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
gcc-5 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
gcc-5-multilib : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
lib32asan2 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
lib32gcc-5-dev : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
lib32mpx0 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
libasan2 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
libgcc-5-dev : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
libmpx0 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
libx32asan2 : Depends: gcc-5-base (= 5.4.1-2ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.4 is installed
@jwt625
jwt625 / daily_bugs
Last active November 29, 2017 09:02
terminal
# when updating dpkg, some dependencies break and can't open terminal. This can temporarily fix it and able to open terminal.
# Original error:
# apt-get: relocation error: /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0: symbol _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareERKS4_, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
# After this, still has error from apt:
# libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.5) but it is not going to be installed
# Breaks: libreoffice-core (<= 1:4.4.4~rc3-0ubuntu1) but 1:4.2.8-0ubuntu5.2 is to be installed
sudo dpkg -i --auto-deconfigure libstdc++6_5.4.0-6ubuntu1_16.04.5_amd64.deb
# finally fixed, history:581 sudo dpkg -i libstdc++6_5.3.1-14ubuntu2_amd64.deb
582 sudo dpkg --force-depends -r libstdc++6:i386
@jwt625
jwt625 / export.txt
Created June 27, 2017 16:30
Tsinghua Library History
第1条记录, 共166条
主要责任者 Nering, Evar D.
题名 Linear algebra and matrix theory / Evar D. Nering.
出版发行 New York : Wiley, 1970.
索书号 O151.2 FN44.
第2条记录, 共166条
主要责任者 Lang, Serge, 1927-
题名 Complex analysis = 复分析 / Serge Lang.
出版发行 北京 : 世界图书出版公司, 2003.
@jwt625
jwt625 / insertTime.py
Created June 16, 2017 08:26
insert date and time in sublime
import sublime, sublime_plugin, time
class InsertDatetimeCommand(sublime_plugin.TextCommand):
def run(self, edit):
sel = self.view.sel()
for s in sel:
# self.view.replace(edit, s, time.ctime())
self.view.replace(edit, s, time.strftime('D%Y%m%dT%H%M'))