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
-- | |
-- PostgreSQL database dump | |
-- | |
-- Dumped from database version 13.1 | |
-- Dumped by pg_dump version 13.1 | |
-- | |
-- TOC entry 17 (class 2615 OID 214191) |
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
sudo dmidecode -t memory | grep Size: | sed -e 's/Size://g' | sed -e 's/ MB//g' | awk '{sum += $1} END {print sum}' |
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
sudo dmidecode -t memory | |
# dmidecode 3.1 | |
Getting SMBIOS data from sysfs. | |
SMBIOS 2.7 present. | |
Handle 0x0013, DMI type 16, 23 bytes | |
Physical Memory Array | |
Location: System Board Or Motherboard | |
Use: System Memory | |
Error Correction Type: Multi-bit ECC |
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
private void start(Runnable consumer, long initialDelay, int step) { | |
LOG.info("launching consumer {} ...", consumer.getClass().getCanonicalName()); | |
CompletableFuture<Object> promise = new CompletableFuture<>(); | |
LOG.info("delayed with: {}", initialDelay + step); | |
scheduler.schedule(() -> promise.complete(null), initialDelay + step, TimeUnit.SECONDS); | |
// waiting when promise completes | |
CompletableFuture<Void> voidCompletableFuture = promise.thenRunAsync(consumer, executor) | |
.exceptionally((t) -> { |
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
class StreamTest { | |
public static long factorial(long n) { | |
return LongStream.range(1, n+1).reduce(1, (a,b) -> a*b); | |
} | |
} |
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 name, osm_id, | |
ST_Distance_Sphere(ST_Transform(way::geometry, 4326),ST_SetSRID(ST_MakePoint(47.217507, 56.113372), 4326)) as dist | |
FROM planet_osm_point WHERE ST_Distance_Sphere(ST_Transform(way::geometry, 4326), ST_SetSRID(ST_MakePoint(47.217507, 56.113372), 4326)) < 1500 limit 10; | |
SELECT points.name, points.dist, nodes.tags FROM | |
(SELECT name, osm_id, dist FROM | |
(SELECT name, osm_id, ST_Distance_Sphere(ST_Transform(way::geometry, 4326), | |
ST_SetSRID(ST_MakePoint(47.24982, 56.131380000000007), 4326)) AS dist | |
FROM planet_osm_point | |
WHERE ST_Within(ST_Transform(way::geometry, 4326), |
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 name, osm_id, | |
ST_Distance_Sphere(ST_Transform(way::geometry, 4326),ST_SetSRID(ST_MakePoint(47.217507, 56.113372), 4326)) as dist | |
FROM planet_osm_point WHERE ST_Distance_Sphere(ST_Transform(way::geometry, 4326), ST_SetSRID(ST_MakePoint(47.217507, 56.113372), 4326)) < 1500 limit 10; | |
SELECT points.name, points.dist, nodes.tags FROM | |
(SELECT name, osm_id, dist FROM | |
(SELECT name, osm_id, ST_Distance_Sphere(ST_Transform(way::geometry, 4326), | |
ST_SetSRID(ST_MakePoint(47.24982, 56.131380000000007), 4326)) AS dist | |
FROM planet_osm_point | |
WHERE ST_Within(ST_Transform(way::geometry, 4326), |
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
x = 1 | |
y = 5 | |
x ^= y | |
y ^= x | |
x ^= y | |
x = 5 | |
y = 1 |
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 re | |
from sys import argv | |
from time import time | |
class Login(object): | |
def __init__(self): | |
self.r = re.compile('^([a-z]|[a-z][a-z0-9-\.]{0,18}[a-z0-9])$', re.I) | |
self.charmap_min = ord('a') | |
self.charmap_max = ord('z') | |
self.charmap_min_dig = ord('0') |
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
def zip_gen(list_key, list_value): | |
''' | |
>>> dict([(a,b) for (a,b) in zip_gen([1,2,3,4], ['a','b','c','d'])]) | |
{1: 'a', 2: 'b', 3: 'c', 4: 'd'} | |
>>> dict([(a,b) for (a,b) in zip_gen([1,2], ['a','b','c','d'])]) | |
{1: 'a', 2: 'b'} | |
>>> dict([(a,b) for (a,b) in zip_gen([1,2,3,4], ['a'])]) | |
{1: 'a', 2: None, 3: None, 4: None} | |
''' |
NewerOlder