Skip to content

Instantly share code, notes, and snippets.

@CodePint
CodePint / detect_case.py
Created September 27, 2022 15:58
detect what case a string is in using python humps package
import humps
def detect_case(value):
for case in ['snake', 'camel', 'pascal', 'kebab']:
if getattr(humps, f"is_{case}case")(value):
return case
return 'unknown'
import humps
def detect_case(value):
for case in ['snake', 'camel', 'pascal', 'kebab']:
if getattr(humps, f"is_{case}case")(value):
return case
return 'unknown'
#!/usr/bin/python3
import requests
KIBANA_HOST = 'http://127.0.0.1:5601'
ELASTICSEARCH_HOST = 'http://127.0.0.1:9200'
BUILTIN_INDEX_SCHEMES = ('.kibana', '.apm')
def get_indices(es_host):
#!/usr/bin/env python3
# For a string containing only the letters A C G T, how would you count the occurrences
# of each triplet (overlapping three character substrings)? For example, in the input
# string "AACTGATGCTGACTGATAGTA" the characters "TGA" appear three times.
#
# AACTGATGCTGACTGATAGTA
# TGA: --- --- ---
#
# Produce a Python function (or class) that calculates these triplet counts, the FORMAT
import logging, re, os
import urllib.parse
import boto3
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
dynamodb = boto3.client('dynamodb')
s3 = boto3.client('s3')
# I just want coffee
import maya.cmds as cmds
import random
# Original article and code
# https://medium.com/take-a-bite-of-bits-and-bytes/intro-to-python-scripting-for-maya-e02ba87175b5
# https://github.com/Cheryl-Lao/BitsAndBytes/blob/master/hatCreatorV1.py
def create(cone=None, pompom=None):
# create the objects
cone, pompom = cone or {}, pompom or {}
function upto(x) {
console.log("print has been started!")
for (var i = 1; i < x; i++) {
console.log(i);
}
console.log("print has been finished!")
}
source 'https://rubygems.org'
gem 'puma'
gem 'sinatra'
gem 'sinatra-cross_origin'
gem 'rack-parser'
gem 'rake'
gem 'tzinfo-data', '1.2016.5'
gem 'envied', '~> 0.9'
def sum_pairs(numbers, sum)
seen = Array.new
numbers.each do |n|
if seen.include?(sum - n)
return [sum - n, n]
end
seen << n
end
nil
end
<body>
<h1> This is a HTML document </h1>
<div> This is my DIV</div>
</body>