Skip to content

Instantly share code, notes, and snippets.

View zhanggang807's full-sized avatar
🤗

Dean Zhang zhanggang807

🤗
View GitHub Profile
@zhanggang807
zhanggang807 / Manacher.java
Created October 4, 2018 14:31
最长回文子串算法
public class Manacher{
public static void main(String[] args) {
String line = "ababbbb";
System.out.println("最大回文子串: "+Manacher(line));
}
public static String Manacher(String s) {
// Insert '#'
String t = "$#";
for (int i = 0; i < s.length(); ++i) {
@zhanggang807
zhanggang807 / resize-app-window.scpt
Created September 29, 2018 06:50
resize macos app window
set theApp to "App Name"
(*
tell application theApp to get the bounds of the window 1
*)
tell application theApp
set bounds of front window to {753, 275, 1807, 1165}
end tell
@zhanggang807
zhanggang807 / resize_window.scpt
Created September 29, 2018 05:36 — forked from keflavich/resize_window.scpt
Applescript to resize all windows from a given application. Source credit given in the top.
(*
From http://www.labnol.org/software/resize-mac-windows-to-specific-size/28345/
This Apple script will resize any program window to an exact size and the
window is then moved to the center of your screen. Specify the program name,
height and width below and run the script.
Written by Amit Agarwal on December 10, 2013
*)
@zhanggang807
zhanggang807 / CallableTest.java
Created September 27, 2018 08:35
测试使用Callable,包含异常
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
//通过Callable接口模拟一个龟兔赛跑的例子
public class CallableTest {
public static void main(String[] args) {
ExecutorService es = Executors.newFixedThreadPool(2); //开启两个线程
@zhanggang807
zhanggang807 / tdsFromTable.js
Last active September 27, 2018 02:30
get all of td from a table tag
var rows = document.getElementById('grid-table').rows
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var tds = row.children;
for (var j = 0; j < tds.length; j++) {
var td = tds[j];
//console.log(td.getAttribute("title"))
if (td.getAttribute("title") == '0'){
td.click();
@zhanggang807
zhanggang807 / IntelliJ_IDEA__Perf_Tuning.txt
Created August 7, 2018 08:50 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@zhanggang807
zhanggang807 / gist:095c1a93a02f6c32bbdac34873bfea99
Created August 1, 2018 12:04 — forked from fabiofl/gist:5873100
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@zhanggang807
zhanggang807 / remindAtTime.py
Created June 28, 2018 02:37
python 定时信息提醒
import os, sys, time, subprocess
from datetime import datetime
from tkinter import messagebox
if len(sys.argv) == 1:
msg = input('请输入提示要做的事情\n')
t = input('请输入到期时间, 格式:时:分:秒\n')
hms = t.split(':') if ':' in t else t.split(':')
h, m, s = hms
@zhanggang807
zhanggang807 / readLineCopy.bat
Created June 18, 2018 10:41
bat script read line from file to exec command such del xcopy
@echo off
set folder=xxx-folder
set source=yyy-folder
for /f "tokens=*" %%A in (C:\Users\Administrator\Desktop\zzz.txt) do (
rem echo %source%%%A %folder%\%%A
rem copy %source%%%A %folder%\%%A
echo f | xcopy %source%%%A %folder%\%%A /s /e /y
)
@zhanggang807
zhanggang807 / Mutex.java
Last active March 22, 2018 06:02
java aqs official demo
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
/**
* Here is a non-reentrant mutual exclusion lock class that uses the value zero to represent the unlocked state,