Skip to content

Instantly share code, notes, and snippets.

View cyrillkuettel's full-sized avatar

Cyrill Küttel cyrillkuettel

  • Switzerland
View GitHub Profile
View elastic_search_onegov.md

Java / elasticsearch

First, remove all existing java installations:

sudo apt-get purge openjdk-\*
sudo rm -rf /usr/lib/jvm/*

Install Java 8, same version as on build server:

@cyrillkuettel
cyrillkuettel / print_methods.py
Created January 10, 2023 10:18
Get all methods of object at runtime
View print_methods.py
def get_methods(object, spacing=20):
""" Convenience method to print all methods at runtime. """
method_list = []
for method_name in dir(object):
try:
if callable(getattr(object, method_name)):
method_list.append(str(method_name))
except Exception:
method_list.append(str(method_name))
process_func = (lambda s: ' '.join(s.split())) or (lambda s: s)
@cyrillkuettel
cyrillkuettel / Overleaf_Custom_Vim_bindings.js
Created November 26, 2022 15:30
Demonstrates how to inject custom vim settings in CodeMirror 6 Editor.
View Overleaf_Custom_Vim_bindings.js
// ==UserScript==
// @name Overleaf Custom Vim bindings
// @match https://www.overleaf.com/project/*
// @version 0.1
// @description Injecting custom vim settings in overleaf project. CodeMirror 6 editor only.
// @author cyrillkuettel
// @match https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo/related?hl=de
// @grant none
// ==/UserScript==
View Adapter to translate a path from Pyfilesystem to Pathlib.py
class PathAdapter(PosixPath):
"""
Adapter to translate a Sub Filesystem from Pyfilesystem to Pathlib.
Use like this:
from fs import open_fs
from pathlib import Path, PosixPath
your_fs = open_fs('/tmp/test/')
View yt-dlp termux full installation guide.md
View p_vs_np_4_Raymond_Hettinger_PyCon2015.py
''' Pythonic means "coding beautifully in harmony with
the language to get the maximum benefits from Python"
Learn to recognize non-pythonic APIs and to recognize
good code. Don't get distracted by PEP 8. Focus
first an Pythonic versus NonPython (P vs NP).
When needed, write an adapter class to convert from
the former to the latter.
* Avoid unnecessart packageing in favor of
simpler imports
View p_vs_np_3_Raymond_Hettinger_PyCon2015.py
from nettools import NetworkElement
with NetworkElement('171.0.2.45') as ne:
for route in ne.routing_table:
print "%15s -> %s" % (route.name, route.ipaddr)
View p_vs_np_2_Raymond_Hettinger_PyCon2015.py
import jnettool.tools.elements.NetworkElement
import jnettool.tools.Routing
import jnettool.tools.RouteInsector
ne = jnettool.tools.elements.NetworkElement('171.0.2.45')
try:
routing_table = ne.getRoutingTable()
except jnettool.tools.elements.MissingVar:
logging.exception('No routing table found')
View 03_local_search.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyrillkuettel
cyrillkuettel / mutliple_remote_url.md
Last active August 23, 2022 11:31
Add multiple remote origin urls to git
View mutliple_remote_url.md