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 main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func Sqrt(x float64) float64 { | |
| z := x / 2 | |
| epsilon := 0.001 |
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
| import org.apache.parquet.hadoop.ParquetOutputFormat | |
| import org.apache.spark.sql.SaveMode | |
| import org.apache.spark.sql.SparkSession | |
| fun main() { | |
| val session = createSparkSession("test", 1) | |
| val df = session.read().format("jdbc") | |
| .option("url", "jdbc:postgresql://localhost:6432/pg-atlas-v2-stg-other?user=postgres") | |
| .option("query", """select * from usdt_trx_udm_v2_transactions |
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
| sourceSets { | |
| create("integrationTest") { | |
| compileClasspath += main.get().output + configurations.testRuntimeClasspath | |
| runtimeClasspath += output + compileClasspath | |
| } | |
| } | |
| val integrationTestImplementation: Configuration by configurations.getting { | |
| extendsFrom(configurations.implementation.get()) | |
| } |
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
| SELECT schema_name, | |
| pg_size_pretty(sum(table_size)::bigint), | |
| (sum(table_size) / pg_database_size(current_database())) * 100 | |
| FROM ( | |
| SELECT pg_catalog.pg_namespace.nspname as schema_name, | |
| pg_relation_size(pg_catalog.pg_class.oid) as table_size | |
| FROM pg_catalog.pg_class | |
| JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid | |
| ) t | |
| GROUP BY schema_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
| select l.pid, relation::regclass, mode, a.application_name, a.query_start, locktype, | |
| (classid::bigint << 32) | objid::bigint as hash | |
| from pg_locks l join pg_stat_activity a on l.pid = a.pid where granted; |
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
| fun main() { | |
| runBlocking { | |
| repeat(10) { | |
| try { | |
| // CoroutineScope(coroutineContext + SupervisorJob()).run { | |
| supervisorScope { | |
| listOf( | |
| async { | |
| throw IllegalStateException("ERROR OCCURRED.") | |
| }, |
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
| import psycopg2.extras | |
| # del os.environ["PGTZ"] | |
| # os.environ["PGTZ"]="UTC" | |
| # os.environ["PGTZ"]="Europe/Moscow" | |
| conn = psycopg2.connect( | |
| # host="postgres-corecms-slave.spb.play.dc", | |
| host="postgres-context-slave.spb.play.dc", | |
| port=5433, | |
| dbname="context", |
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
| from sqlalchemy import create_engine | |
| engine = create_engine("postgresql://<name>:<password>@postgres-context-slave.spb.play.dc:5433/context", echo=True, connect_args={"options": "-c TimeZone=UTC"}) |
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
| val events = CopyOnWriteArrayList<UserSubscriptionExternalActivationEvent>() | |
| val listenerContainer = rabbitConfig.bind<UserSubscriptionExternalActivationEvent>( | |
| routingKey.externalActivation, | |
| TopicExchange(properties.template.exchange), | |
| ) { | |
| println("result is $it") | |
| events.add(it) | |
| Mono.empty() | |
| } | |
| listenerContainer.start() |
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
| use std::sync::{Arc, Mutex, MutexGuard}; | |
| use std::collections::HashMap; | |
| use std::ops::Deref; | |
| pub struct Inner<'a>(MutexGuard<'a, HashMap<i32, Vec<i32>>>, i32); | |
| impl<'a> Deref for Inner<'a> { | |
| type Target = Vec<i32>; | |
| fn deref(&self) -> &Self::Target { | |
| self.0.get(&self.1).unwrap() |
NewerOlder