Skip to content

Instantly share code, notes, and snippets.

View ldynia's full-sized avatar

ldynia

View GitHub Profile
@ldynia
ldynia / gist:4978b85664f480fa4c50f5c1c4809143
Created May 16, 2024 05:58
Get data from open-meteo.com API in Python
import requests
...
city = CityRepository.filter(uuid=uuid).first()
...
query_params = {
"daily": [
"rain_sum",
"showers_sum",
"snowfall_sum",
@ldynia
ldynia / chameleon.py
Created December 15, 2020 13:49
ChameLeon
import re
camel = 'ChameLeon'
snake = re.sub(r'(?<!^)(?=[A-Z])', '_', camel).lower()
print(snake)
@ldynia
ldynia / chameleon.py
Created December 15, 2020 13:49
ChameLeon
import re
camel = 'ChameLeon'
snake = re.sub(r'(?<!^)(?=[A-Z])', '_', camel).lower()
print(snake)
@ldynia
ldynia / chameleon.py
Created December 15, 2020 13:47
CameLeon
import re
camel = 'ChameLeon'
snake = re.sub(r'(?<!^)(?=[A-Z])', '_', camel).lower()
print(snake)
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+,",
"command": "editor.action.addSelectionToPreviousFindMatch"
},
{
"key": "alt+d",
"command": "editor.action.duplicateSelection"
},
#!/bin/python3
import math
import os
import random
import re
import sys
def sockMerchant(n, ar):
#!/bin/python3
import math
import os
import random
import re
import sys
def countingValleys(n, s):
@ldynia
ldynia / json_output.py
Created March 27, 2020 16:21
Example of valid JSON string
#!/usr/bin/env python3
import json
data_dict = {'is_claimed': 'True', 'rating': 3.5}
json_str = json.dumps(data_dict)
print(json_str)
## How to run program
@ldynia
ldynia / gist:0417b70badad0c8c1809dda2c38a0f68
Created December 5, 2019 11:13
Virtualbox and libvirt
Vagrant.configure("2") do |config|
config.vm.box = 'centos/7'
config.vm.define "test_vm" do |test_vm|
test_vm.vm.hostname = "test-vm"
test_vm.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 1024
@ldynia
ldynia / gist:8df1128c8e6af5eae45a94551083ef7e
Created December 29, 2018 13:24
Errata: Kubernetes for Developers - simple CronJob example
# Error version
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: helloworld
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template: spec: