Skip to content

Instantly share code, notes, and snippets.

@liudonghua123
liudonghua123 / OpenWithSublimeText3.bat
Created February 3, 2018 06:02 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@liudonghua123
liudonghua123 / vsCodeOpenFolder.reg
Last active February 28, 2018 07:18
Right click on Windows folder and open with Visual Studio Code
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@liudonghua123
liudonghua123 / stack_queue.py
Created June 21, 2018 06:50
Simple Stack and Queue implementation
# coding=utf-8
class Stack(object):
def __init__(self):
self.data = []
def pop(self):
return self.data.pop()
def push(self, element):
@liudonghua123
liudonghua123 / LinkedList.py
Last active June 21, 2018 08:09
Simple python implementation of LinkedList
# coding=utf-8
class LinkedList(object):
# define the node type
class Node:
def __init__(self, element, next):
self.element = element
self.next = next
@liudonghua123
liudonghua123 / gcc.bat
Created June 29, 2018 07:57
Some configuration files for c/c++ dev on wsl of vscode.
c:/windows/sysnative/bash.exe -c "gcc -g %1 -o %2"
@liudonghua123
liudonghua123 / convert.sh
Created June 29, 2018 08:39
convert image batch scripts
#!/bin/bash
convert_percentage=25%
output_folder=resized-images-${convert_percentage}
# if [ ! -d ${output_folder} ]
# then
# mkdir -p ${output_folder}
# fi
[ -d ${output_folder} ] || mkdir -p ${output_folder}
for filename in origin/*.jpg; do
echo convert -resize ${convert_percentage} $filename ${output_folder}/$(basename $filename)
@liudonghua123
liudonghua123 / visor-archivos-online.md
Created September 12, 2018 02:18 — forked from vrajroham/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@liudonghua123
liudonghua123 / bind-update-script.sh
Created September 14, 2018 07:58 — forked from mattrude/bind-update-script.sh
Bind 9.11+ Update script for Ubuntu 16.04 LTS
#!/bin/bash
BINDVER=`curl -slL ftp://ftp.isc.org/isc/bind9/cur/9.11/ |grep ".tar.gz$" |sed 's/bind-//g' |sed 's/.tar.gz//g'`
if [ -f /usr/local/sbin/named ]; then
CURRENTVER=`/usr/local/sbin/named -v |awk '{ print $2 }'`
elif [ -f /usr/sbin/named ]; then
CURRENTVER=`/usr/sbin/named -v |awk '{ print $2 }'`
else
CURRENTVER=0
@liudonghua123
liudonghua123 / main.py
Last active January 10, 2019 13:50
process xlsx with template
from openpyxl import Workbook, load_workbook
from openpyxl.styles.borders import Border, Side
import os
import re
def getData(filePath):
wb = load_workbook(filename=filePath)
sheet = wb.worksheets[0]
row_count = sheet.max_row
@liudonghua123
liudonghua123 / simple-soap.js
Created May 31, 2019 06:45
A simple node app for soap operation demonstration
const getCircularReplacer = () => {
const seen = new WeakSet();
return (key, value) => {
if (typeof value === "object" && value !== null) {
if (seen.has(value)) {
return;
}
seen.add(value);
}