Skip to content

Instantly share code, notes, and snippets.

View kbzowski's full-sized avatar

Krzysztof kbzowski

  • AGH University of Science and Technology
  • Krakow, Poland
View GitHub Profile
@trnsnt
trnsnt / ovh_api.sh
Created October 31, 2017 14:58
Simple OVH API bash example
#!/bin/bash
OVH_CONSUMER_KEY="***"
OVH_APP_KEY="***"
OVH_APP_SECRET="***"
HTTP_METHOD="GET"
HTTP_QUERY="https://api.ovh.com/1.0/domain"
HTTP_BODY=""
@jrmontag
jrmontag / gist:957b4bb8f4b89d5006a8
Last active September 21, 2022 12:07
split a string at every nth occurrence of a delimiter (here, a pipe) in Python
import re
s = 'id|tag1|id|tag2|id|tag3|id|tag4'
# nb: escaping | (delimiter) necessary *outside* of character set ( [] ), not inside
print re.findall("[^|]+\|[^|]+", s)
# ['id|tag1', 'id|tag2', 'id|tag3', 'id|tag4']
n=3