This file contains hidden or 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
# Works on Linux and Mac OS | |
cat /dev/urandom | strings | grep -m 1 -oEi '[a-zA-Z0-9_^!#]{8}' |
This file contains hidden or 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
# redirect stdout to a file | |
cat 1.txt > r.txt | |
# redirect stderr to a file | |
grep "error" 1.log 2> r.txt | |
# redirect stdout to a stderr | |
grep * 1>&2 | |
# redirect stderr to a stdout |
This file contains hidden or 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 | |
SafariInfected=0 | |
echo -n "Checking Safari... " | |
if [[ -z `defaults read /Applications/Safari.app/Contents/Info LSEnvironment 2>&1 | grep "does not exist"` ]]; then | |
SafariInfected=1 | |
echo "INFECTED." | |
else | |
echo "NOT INFECTED." | |
fi |
This file contains hidden or 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 | |
function adjust() { | |
local cwd=$(pwd) | |
local sd=$1 | |
local total=$2 | |
local mtime1=0 | |
local mtime2=0 | |
local gap=0 | |
cd ${sd} | |
for ssd in $(ls -t -r -d */) |
This file contains hidden or 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 | |
function adjust() { | |
local cwd=$(pwd) | |
local sd=$1 | |
local total=$2 | |
local mtime1=0 | |
local mtime2=0 | |
local gap=0 | |
cd ${sd} |
This file contains hidden or 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/sh | |
# | |
# Locate matlab binary executable file. | |
# | |
MATLAB=$(which matlab) | |
if [ -z ${MATLAB} ]; then | |
if [ -n ${MATLAB_HOME} ]; then | |
MATLAB=${MATLAB_HOME}/bin/matlab |
This file contains hidden or 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 class GWTExample { | |
public static void openUrlInNewWindow(String url, String name) { | |
// Open a new browser window | |
com.google.gwt.user.client.Window.open(url, name, "menubar=no,location=false,resizable=yes,scrollbars=yes,status=no,dependent=true"); | |
} | |
} |
This file contains hidden or 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 class GWTExample { | |
public static void openRelativeURL(String path, String name) { | |
String url = GWT.getHostPageBaseURL() + path; | |
com.google.gwt.user.client.Window.open(url, name, null); | |
} | |
public static void main(String[] args){ | |
openRelativeURL("about.html"); | |
} |
This file contains hidden or 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
<div id="my_output_div"></div> | |
<script src="http://java.com/js/deployJava.js"></script> | |
<script type="text/javascript"> | |
var html = '<ul>'; | |
html += '<li><b>Installed JREs:</b>' + deployJava.getJREs() + '</li>'; | |
html += '<li><b>Version Check (>= 1.6.0?):</b>' + deployJava.versionCheck('1.6.0+') + '</li>'; | |
html += '<li><button onClick="deployJava.installLatestJRE();">Install latest JRE</button></li>'; | |
var div = document.getElementById('my_output_div'); | |
div.innerHTML=html; | |
</script> |
This file contains hidden or 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
set mylist "1 2 3 4 5" | |
# prints the last element of mylist: 5 | |
puts [lindex $mylist end] | |
# prints the first element of mylist: 1 | |
puts [lindex $mylist 0] |
OlderNewer