Skip to content

Instantly share code, notes, and snippets.

View shauway's full-sized avatar

Shauway shauway

View GitHub Profile
@hanleybrand
hanleybrand / java_String_hashcode.py
Last active November 20, 2022 18:09
python function that produces the same result as java's String.hashCode() found at http://garage.pimentech.net/libcommonPython_src_python_libcommon_javastringhashcode/
def java_string_hashcode(s):
h = 0
for c in s:
h = (31 * h + ord(c)) & 0xFFFFFFFF
return ((h + 0x80000000) & 0xFFFFFFFF) - 0x80000000
@antpk
antpk / SQL-Insert-Statements-Bulk-100per.sql.groovy
Created March 7, 2019 06:55
SQL Bulk insert export script for DataGrip with limit
SEP = ", "
QUOTE = "\'"
NEWLINE = System.getProperty("line.separator")
KEYWORDS_LOWERCASE = com.intellij.database.util.DbSqlUtil.areKeywordsLowerCase(PROJECT)
KW_INSERT_INTO = KEYWORDS_LOWERCASE ? "insert into " : "INSERT INTO "
KW_VALUES = KEYWORDS_LOWERCASE ? "values" : "VALUES"
KW_NULL = KEYWORDS_LOWERCASE ? "null" : "NULL"