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
version: '3.8' | |
services: | |
app: | |
image: nginx | |
volumes: | |
- "./docker/nginx/sites/:/etc/nginx/conf.d" | |
ports: | |
- "80:80" | |
networks: |
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
upstream authUpstream { | |
server auth:9090 max_fails=0 fail_timeout=10s; | |
keepalive 512; | |
} | |
upstream service1Upstream { | |
server services1:9091 max_fails=0 fail_timeout=10s; | |
keepalive 512; | |
} |
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
# for select duplicate | |
SELECT * FROM `lb` t1, `users` t2 WHERE t1.user_id = t2.id AND t2.dff_stm = 1 ; | |
# for delete duplicate | |
DELETE t1 FROM `lb` t1, `users` t2 WHERE t1.user_id > t2.id AND t2.dff_stm = 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
version: '3.1' | |
services: | |
db_mysql: | |
image: mysql | |
command: | |
- --default-authentication-plugin=caching_sha2_password | |
restart: always | |
environment: |
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 redis | |
source = redis.Redis(host='localhost', port=63790, db=1) | |
#destination = redis.Redis(host='localhost', port=63790, db=5) | |
keys = source.keys('auth-service:*') | |
print("key,vallue,ttl") | |
for key in keys: | |
#destination.set(key, source.get(key), source.ttl(key)) |
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
DO | |
$$ | |
DECLARE | |
rec RECORD; | |
lastId INT; | |
BEGIN | |
FOR rec IN (SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = (SELECT current_schema()) | |
AND table_type = 'BASE TABLE') |
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
function power(base, exponent) { | |
let result = 1; | |
for (let i = 0; i < Math.floor(exponent); i++) { | |
result *= base; | |
} | |
if (exponent % 1 !== 0) { | |
result *= base ** (exponent % 1); | |
} | |
return result; | |
} |
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
function sqrt(number) { | |
if (number < 0) { | |
throw new Error("Square root of a negative number is undefined"); | |
} | |
let guess = number / 2; | |
const precision = 0.0001; // Adjust the precision as needed | |
while (Math.abs(guess * guess - number) > precision) { | |
guess = (guess + number / guess) / 2; |
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
invoice_id | id | product_id | price | paid_ammount | |
---|---|---|---|---|---|
INV000001 | 1 | 40 | 450 | 450 | |
INV000002 | 2 | 50 | 5000 | 5000 | |
INV000003 | 3 | 200 | 400 | 400 |
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
id | product_id | price | paid_ammount | |
---|---|---|---|---|
1 | 40 | 450 | 450 | |
2 | 50 | 5000 | 5000 | |
3 | 200 | 400 | 400 |
NewerOlder