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 IntegerArrayType implements UserType { | |
protected static final int SQLTYPE = java.sql.Types.ARRAY; | |
@Override | |
public Object nullSafeGet(final ResultSet rs, final String[] names, final SessionImplementor sessionImplementor, final Object owner) throws HibernateException, SQLException { | |
Array array = rs.getArray(names[0]); | |
Integer[] javaArray = (Integer[]) array.getArray(); | |
return ArrayUtils.toPrimitive(javaArray); | |
} |
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 int safeLongToInt(long l) { | |
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { | |
throw new IllegalArgumentException | |
(l + " cannot be cast to int without changing its value."); | |
} | |
return (int) l; | |
} |
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
#include <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
char *addr; | |
if (argc < 2) { | |
printf("Usage:\n%s <environment variable name>\n", argv[0]); | |
exit(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
import os | |
def get_case_sensitive_pathname(path, top): | |
for root, dirs, files in os.walk(top): | |
for d in dirs: | |
if os.path.join(root, d).lower() == path.lower(): | |
return os.path.join(root, d) | |
for f in files: | |
if os.path.join(root, f).lower() == path.lower(): | |
return os.path.join(root, f) |
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
def enum(**enums): | |
return type('Enum', (), enums) |
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 argparse | |
import os | |
import pefile | |
class DllCharacteristics(): | |
def __init__(self): | |
self.IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = False | |
self.IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = False | |
self.IMAGE_DLLCHARACTERISTICS_NO_BIND = False |
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
def is_equal(a, b): | |
if len(a) != len(b): | |
return False | |
result = 0 | |
for x, y in zip(a, b): | |
result |= x ^ y | |
return result == 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 python | |
from __future__ import print_function | |
import sys | |
import os | |
import re | |
import ctypes | |
import argparse | |
ulseek = ctypes.cdll['libc.so.6'].lseek | |
ulseek.restype = ctypes.c_uint64 |
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
#include <stdio.h> | |
#include <unistd.h> | |
int main() { | |
while (1) { | |
printf("hello\n"); | |
sleep(1); | |
} | |
} |
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 m = "python2.7"; | |
var ex = "PyTraceBack_Type"; | |
var module = Process.getModuleByName(m) | |
console.log(JSON.stringify(module)); | |
for (var e of module.enumerateExports()) { | |
if (e.name == ex) { | |
console.log(JSON.stringify(e)); | |
} |