Skip to content

Instantly share code, notes, and snippets.

View remram44's full-sized avatar

Remi Rampin remram44

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@remram44
remram44 / dockerfile
Last active June 11, 2020 20:13
Nominatim config
FROM mediagis/nominatim
# Increase memory limit
RUN find /etc -name php.ini -exec sed -i '/^memory_limit *= *[0-9]/ c memory_limit = 1024M' {} ';'
RUN find /app -name \*.php\* -exec sed -i "s/ini_set('memory_limit', *'[0-9]\+M');/ini_set('memory_limit', '1024M');/" {} ';'
# Enable batch mode
RUN bash -c "cd /app/src/build && echo $'--- settings/settings.php\\n\
+++ settings/settings.php\\n\
@@ -106 +106 @@\\n\
class SimpleConverter(object):
@staticmethod
def transform(source: str, dest: str) -> None:
raise NotImplementedError
def tsv_to_csv(source: str, dest: str) -> None:
...
class_name SafeNodeRef
extends Reference
var node_ref = null
func _init(node):
node_ref = node
if node == null:
pass
elif not node is Node:
@remram44
remram44 / pyyaml.patch
Created April 7, 2020 21:58
PyYAML patch to discard values
diff --git a/ext/_yaml.pyx b/ext/_yaml.pyx
index ff4efe8..876a6c6 100644
--- a/ext/_yaml.pyx
+++ b/ext/_yaml.pyx
@@ -258,8 +258,11 @@ cdef class CParser:
cdef int stream_cache_len
cdef int stream_cache_pos
cdef int unicode_source
+ cdef object filter
+ cdef object path
@remram44
remram44 / yaml_filter.py
Last active April 7, 2020 15:15
Filtering YAML loader
import json
import sys
import yaml
import yaml.events
import yaml.nodes
class FilterLoader(yaml.SafeLoader):
def __init__(self, stream):
super(FilterLoader, self).__init__(stream)
@remram44
remram44 / prometheus_process_monitor.py
Last active April 2, 2022 08:43
Monitor multiple processes using Prometheus
import prometheus_client
from prometheus_client.core import GaugeMetricFamily, REGISTRY
import psutil
import time
class Collector(object):
def collect(self):
cpu_percent = GaugeMetricFamily(
'nominatim_cpu_percentage',
*~
01-orig
02-global
03-struct
@remram44
remram44 / index.html
Last active July 27, 2022 14:02
Python release timeline
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
td, th {
border: 1px solid black;
white-space: nowrap;
}
table {
border-collapse: collapse;
cargo crev
config Config
completions Completions
edit Edit the config file
crate Crate related operations (review, verify...)
clean Clean a crate source code (eg. after review)
diff Diff between two versions of a package
dir Query source directory of a package
goto Start a shell in source directory of a crate under review
info Display rich info about the given crate