This file contains hidden or 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
| #!/bin/bash | |
| export AWS_ACCESS_KEY_ID=... | |
| export AWS_SECRET_ACCESS_KEY=... | |
| export AWS_DEFAULT_REGION=... | |
| PG_HOST=... | |
| PG_USER=... | |
| PG_PASS='...' | |
| PG_DB=... |
This file contains hidden or 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
| BEGIN; | |
| LOCK TABLE ... IN SHARE MODE; | |
| SET LOCAL WORK_MEM = '256MB'; | |
| ALTER TABLE ...; | |
| COMMIT; |
This file contains hidden or 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 final class TurkishNumberUtils { | |
| private static final String SPACE = " "; | |
| private static final String EMPTY = ""; | |
| private static final String[] PERIOD_NAMES = {EMPTY, "bin", "milyon", "milyar", "trilyon", "katrilyon", "kentilyon"}; | |
| private static final String[] UNITS_TEXTS = {EMPTY, "bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz", "dokuz"}; |
This file contains hidden or 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
| lsof -i tcp:8080 | |
| # Example output: | |
| # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
| # java 86935 ... |
This file contains hidden or 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 INDEX CONCURRENTLY your_index_name on your_table_name (your_column_name); | |
| DROP INDEX CONCURRENTLY your_index_name; |
This file contains hidden or 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 EXTENSION pgcrypto; | |
| -- Examples | |
| SELECT ENCODE(DIGEST('password', 'md5'), 'hex'); | |
| SELECT ENCODE(DIGEST('password', 'sha1'), 'hex'); | |
| SELECT ENCODE(DIGEST('password', 'sha224'), 'hex'); | |
| SELECT ENCODE(DIGEST('password', 'sha256'), 'hex'); | |
| SELECT ENCODE(DIGEST('password', 'sha384'), 'hex'); | |
| SELECT ENCODE(DIGEST('password', 'sha512'), 'base64'); |
This file contains hidden or 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
| /** | |
| * Scales and translates a value (x) into a new range [a, b]. | |
| * | |
| * Formula: | |
| * f(x) = a + (b - a)(x - min)/(max - min) | |
| * | |
| * See also: https://stackoverflow.com/a/5295202 | |
| */ | |
| public BigDecimal scaleAndTranslateIntoRange(BigDecimal value, BigDecimal actualMin, BigDecimal actualMax, BigDecimal desiredMin, BigDecimal desiredMax) { | |
| return desiredMax.subtract(desiredMin).multiply(value.subtract(actualMin)) |
This file contains hidden or 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
| # export | |
| PGPASSWORD="<PASSWORD>" pg_dump -U <USERNAME> -h <HOST> -d <DB_NAME> -n <SCHEMA_NAME> > export.sql | |
| # import | |
| PGPASSWORD="<PASSWORD>" psql -U <USERNAME> -h <HOST> -d <DB_NAME> -n <SCHEMA_NAME> -f export.sql |
This file contains hidden or 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 ...; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.core.io.Resource; | |
| import org.springframework.stereotype.Service; | |
| import java.io.InputStream; | |
| @Service | |
| public class SomeSpringBeanThatNeedsAResource { |
This file contains hidden or 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
| cat file1 file2 ... fileN | grep "<SEARCHING TEXT>" | awk -F'<DELIMETER>' '{print $1 $2 ... $n;}' | sort | uniq |