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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
'di ' | |
'ig00 ' | |
# VSFTPD auto-MD5 program | |
# | |
# Run man -l <this file> for documentation | |
require 'rb-inotify' |
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
/** | |
* A correct example of performing a SQL query using JDBC. | |
* | |
* See http://lpar.ath0.com/2008/09/05/java-jdbc-and-memory-leaks/ for | |
* discussion; correct examples of Java JDBC code are surprisingly rare. | |
*/ | |
public static void doSomething() { | |
try { | |
Connection connection = DriverManager.getConnection(JDBC_URL); | |
try { |
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
Function WeekNumber(t As NotesDateTime) As String | |
' Wrapper to work out week numbers of NotesDateTime objects in the | |
' current time zone | |
Dim lst As Variant | |
lst = t.LSLocalTime | |
WeekNumber = LSWeekNumber(lst) | |
End Function | |
Function LSWeekNumber(t As Variant) As String | |
' Returns the week number of a NotesDateTime object |
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
/** | |
* Truncate a Java string so that its UTF-8 representation will not | |
* exceed the specified number of bytes. | |
* | |
* For discussion of why you might want to do this, see | |
* http://lpar.ath0.com/2011/06/07/unicode-alchemy-with-db2/ | |
*/ | |
public static String utf8truncate(String input, int length) { | |
StringBuffer result = new StringBuffer(length); | |
int resultlen = 0; |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# Simple password generation in Ruby. | |
# | |
# Generate reasonably secure random passwords of any chosen length, | |
# designed to be somewhat easy for humans to read and remember. | |
# Each password has a capitalized letter and a digit. | |
# | |
# Example: |
NewerOlder