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
private PGPPrivateKey getPrivateKey(Long keyId, String keyPassphrase) { | |
PGPSecretKeyRing pgpSecretKeyRing = null; | |
PGPPrivateKey pgpPrivateKey = null; | |
PGPSecretKey pgpSecretKey = null; | |
try { | |
FileInputStream fis = new FileInputStream("/tmp/sec9.asc"); | |
ArmoredInputStream ais = new ArmoredInputStream(fis); | |
pgpSecretKeyRing = new PGPSecretKeyRing(ais, new BcKeyFingerprintCalculator()); | |
pgpSecretKey = pgpSecretKeyRing.getSecretKey(keyId); |
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
private static String createPassphrase() { | |
long currentTime = System.nanoTime(); | |
char[] x = ("[sprinkles]").toCharArray(); | |
StringBuilder stringBuilder = new StringBuilder(); | |
for (char s : x) { | |
stringBuilder.append("" + currentTime); | |
stringBuilder.append(s); | |
} | |
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
public class MyApplication { | |
public static Context ApplicationContext = null; | |
public static Context getContext() { | |
return ApplicationContext; | |
} | |
} | |
// In your startup activity set the context. | |
MyApplication.ApplicationContext = getApplicationContext(); |
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
private static String saltIt(String passphrase) { | |
String saltChars = "i08q4h0fn23in2034qnvosysag01n40!$#@#$^@#$#ESDGASFXBSDFHDFH2"; | |
char[] salt = saltChars.toCharArray(); | |
StringBuilder stringBuilder = new StringBuilder(); | |
stringBuilder.append(passphrase); | |
for (char s : salt) { | |
stringBuilder.append(s); | |
stringBuilder.append(passphrase); | |
} |
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
private boolean hasTag(Document document, String tag) { | |
NodeList nodeList = document.getElementsByTagName(tag); | |
return (nodeList.getLength() > 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
/* One way to read an InputStream... NOT Recommended when dealing with some InputStreams, especially if that is from a network connection. */ | |
try { | |
byte[] bytes = new byte[inputStream.available()]; | |
inputStream.read(bytes); | |
// do something with the bytes read from the InputStream | |
inputStream.close(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
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
package net.kelvinwilliams.utils | |
import org.w3c.dom.Document; | |
import org.w3c.dom.Element; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import java.sql.ResultSet; | |
import java.sql.ResultSetMetaData; |
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
package [your package name here] | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.sql.*; | |
/** | |
* Created with IntelliJ IDEA. |
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
U 50.30.37.10:5966 -> 10.184.33.102:5060 | |
REGISTER sip:12345d@50.17.231.189 SIP/2.0. | |
Via: SIP/2.0/UDP 62.75.212.215:5966;branch=z9hG4bK-4195776885;rport. | |
Content-Length: 0. | |
From: "12345d"<sip:12345d@50.17.231.189>; tag=3132333435640133313735313839333631. | |
Accept: application/sdp. | |
User-Agent: friendly-scanner. | |
To: "12345d"<sip:12345d@50.17.231.189>. | |
Contact: sip:12345d@50.17.231.189. | |
CSeq: 1 REGISTER. |
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
create view uncommitted_transactions as | |
select t.start_time,s.sid,s.serial#,s.username,s.status,s.schemaname, | |
s.osuser,s.process,s.machine,s.terminal,s.program,s.module,to_char(s.logon_time,'DD/MON/YY HH24:MI:SS') logon_time | |
from v$transaction t, v$session s | |
where s.saddr = t.ses_addr | |
order by start_time; |
OlderNewer