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 boolean is64bitProcess() | |
{ | |
String wow64_kernel = System.getenv("systemroot") + "\\SysWOW64\\kernel32.dll"; | |
if (new File(wow64_kernel).exists()) | |
{ | |
try | |
{ | |
System.load(wow64_kernel); | |
} | |
catch (UnsatisfiedLinkError e) |
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
jbyteArray toJByteArray(JNIEnv * pEnv, array<byte>^ arr) | |
{ | |
jbyteArray jab = pEnv->NewByteArray(arr->Length); | |
pin_ptr<unsigned char> pUnmanagedArr = &arr[0]; | |
pEnv->SetByteArrayRegion(jab, 0, arr->Length , (jbyte*)pUnmanagedArr); | |
return jab; | |
} |
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
jstring Aix::tojString(JNIEnv * pEnv, String^ str) | |
{ | |
array<byte>^ arr = Encoding::UTF8->GetBytes(str); | |
pin_ptr<Byte> pinnedBytes = &arr[0]; | |
jstring s = pEnv->NewStringUTF(reinterpret_cast<char*>(pinnedBytes)); | |
return s; | |
} |
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
const char* toConstChar(JNIEnv* pEnv, jstring jStr) | |
{ | |
const char* nativeString = pEnv->GetStringUTFChars(jStr, JNI_FALSE); | |
pEnv->ReleaseStringUTFChars(jStr, nativeString); | |
return nativeString; | |
} |
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 struct StreamPoint | |
{ | |
private Stream stream; | |
private long offset; | |
public StreamPoint(Stream s) : this(s, s.Position) { } | |
public StreamPoint(Stream s, long pos) | |
{ | |
if (s == null) | |
throw new ArgumentNullException("stream"); | |
stream = s; |
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
using System; | |
using System.IO; | |
public unsafe static T Read<T>(this Stream s) where T : struct | |
{ | |
int i = System.Runtime.InteropServices.Marshal.SizeOf(typeof(T)); | |
byte[] buffer = new byte[i]; | |
s.Read(buffer, 0, i); | |
fixed (byte* pBuffer = &buffer[0]) | |
return (T)System.Runtime.InteropServices.Marshal.PtrToStructure((IntPtr)pBuffer, typeof(T)); |
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 pack = new HashSet<string>(); | |
bool TestCollisions() | |
{ | |
var uid = Guid.NewGuid().GetHashCode(); // sequential key | |
uid = uid << 8; // shift left 8 | |
uid += new Random().Next(0, 255); // add a random value between 0 and 255 | |
return pack.Add(BitConverter.GetBytes(uid).ToBase62()); // encode base-62 (0-9,A-Z,a-z) | |
} | |
void Bachmark(int count) |
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
java -cp ".\plugins\java-decompiler\lib\java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -dgs=true .\JARFILE.jar .\src |
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
[1549,7009,7710,2616,3740] |
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
namespace Calculator | |
{ | |
using static System.Console; | |
using Sprache; | |
using System.Linq; | |
internal class Program | |
{ | |
public static void Main(string[] args) | |
{ |
OlderNewer