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
Find regex: `(?<!\w)(insert|is|into|with|as|select|from|where|between|and|or|distinct|case|when|then|else|end|on|null|not|inner|outer|full|join|left|right|group|by|order|limit|in)(?!\w)` | |
Replace regex: `\U$1\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
import java.sql.Connection | |
import com.typesafe.scalalogging.Logger | |
import com.company.utils.jdbc.MySQLConfig | |
import scalikejdbc.{ConnectionPool, ConnectionPoolSettings, DB, using} | |
import scala.util.control.NonFatal | |
object ConnectionPoolManager { |
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
`yarn application --list | awk '{print $1}' | grep application | xargs yarn application -kill` |
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
<?php | |
namespace Utils; | |
class ImageTextRenderUtils { | |
/** | |
* Returns expected width of rendered text in pixels |
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
from airflow.settings import Session | |
from airflow.utils.db import provide_session | |
from airflow.models import Pool | |
# hive_pool is just an example, you might want to create some other types of pools such as for MySQL | |
@provide_session | |
def create_hive_pool(session: Optional[Session] = None) -> None: | |
pool = Pool(pool=pool_templates['hive_name'], | |
slots=1, | |
description=pool_templates['hive_description']) |
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
class ArrayUtils { | |
/** | |
* - Groups a (non-associative) array of items into associative array of chunks (of items), where key of chunk | |
* is determined by $key_retriever callable | |
* OR | |
* - Groups elements of an array into subarrays, thereby converting Array into Array[group => Array] | |
* | |
* - Check unit-tests to understand further | |
* @param array $data |
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
# reference: https://stackoverflow.com/a/30076212/3679900 | |
git for-each-ref 'refs/remotes/my-origin' --sort=-committerdate refs/heads --format='%(refname:short)%09%(committerdate:relative)%09%(authorname)%09%(subject)%09'|column -ts'|' |
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
rsync -avze "ssh -t -p 272 {user_name_on_entry}@entry.organization.farm ssh admin@XXX.XX.XX.XX" {home_folder_name} :/home/admin/{dest_folder_name} |
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
-- reference: https://stackoverflow.com/a/9620273/3679900 | |
SELECT TABLE_NAME AS `Table`, | |
round(((data_length) / 1024 / 1024 / 1024), 2) `Size-in-GB` | |
FROM information_schema.TABLES | |
WHERE table_schema = 'my_db_name' | |
AND TABLE_NAME IN ('my_table_1', | |
'my_table_2') | |
ORDER BY (data_length) DESC |
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
# this regex will clean output of Hive's SHOW CREATE TABLE .. statement | |
(^\| |\s+\|$| COMMENT 'from deserializer') |
NewerOlder