This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/ | |
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/ | |
cd /usr/share/fonts/truetype/ | |
#TODO: put validation if folder already exists | |
sudo mkdir ttf-monaco |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"====================================== | |
" Author: WarrenFan | |
" Last Modified: 2013-12-08 | |
" Sections: | |
" > General | |
" > View | |
" > Utility | |
" > Plugins | |
"====================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ | |
_ooOoo_ | |
o8888888o | |
88" . "88 | |
(| -_- |) | |
O\ = /O | |
____/`---'\____ | |
.' \\| |// `. | |
/ \\||| : |||// \ | |
/ _||||| -:- |||||_ \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
popupWins = new Array(); | |
function windowOpener(url, name, args) { | |
/******************************* | |
the popupWins array stores an object reference for | |
each separate window that is called, based upon | |
the name attribute that is supplied as an argument | |
*******************************/ | |
if ( typeof( popupWins[name] ) != "object" ){ | |
popupWins[name] = window.open(url,name,args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script type="text/javascript"> | |
if ( window.name == 'popup' ) { | |
document.body.className += ' in-popup' | |
} | |
function selectItemInPopup(item) { | |
window.opener.popupDidSelectItem(window.item); | |
window.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var popupWindow = window.open("popupWindow.html", "WindowName", "width=100, height=30, menubar=no, resizable=no, scrollbars=no"); | |
whenPopupClosed(popupWindow, callback); | |
var whenPopupClosed = function (popupWindow, callback) { | |
var pollTimer = window.setInterval(function() { | |
if (popupWindow.closed !== false) { // !== is required for compatibility with Opera | |
window.clearInterval(pollTimer); | |
callback(); | |
} | |
}, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.InputStream; | |
import java.util.List; | |
import org.apache.commons.fileupload.FileItem; | |
import org.apache.commons.fileupload.FilenameUtils; | |
import org.apache.commons.fileupload.disk.DiskFileItemFactory; | |
import org.apache.commons.fileupload.servlet.ServletFileUpload; | |
List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); | |
for (FileItem item : items) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The difference between the Windows epoch (1601-01-01 00:00:00) and the Unix epoch (1970-01-01 00:00:00) in milliseconds: 11644473600000L. | |
private final static long WINDOWS_UNIX_EPOCH_DIFF_MILLISECONDS = 11644473600000L; | |
public static Date parseDateFromADTimestamp(String strADTimestamp) { | |
long adTimestamp = Long.parseLong(strADTimestamp); | |
long millisecondsTime = (adTimestamp / 10000) - WINDOWS_UNIX_EPOCH_DIFF_MILLISECONDS; | |
Date date = new Date(millisecondsTime); | |
return date; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String humanReadableByteCount(long bytes, boolean si) { | |
int unit = si ? 1000 : 1024; | |
if (bytes < unit) return bytes + " B"; | |
int exp = (int) (Math.log(bytes) / Math.log(unit)); | |
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); | |
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
tell network preferences | |
do shell script "scselect 'Dorm'" | |
do shell script "sudo networksetup -setairportpower AirPort on" user name "用户名" password "密码" with administrator privileges | |
do shell script "open /Applications/Shad**socksX.app" user name “用户名" password "密码" with administrator privileges | |
end tell | |
end tell |
OlderNewer