Skip to content

Instantly share code, notes, and snippets.

View smaeda-ks's full-sized avatar
🏠
Timezone will never be easy

Shohei Maeda smaeda-ks

🏠
Timezone will never be easy
View GitHub Profile
@Integralist
Integralist / Import Steps.md
Last active September 25, 2024 02:05
[Fastly Terraform Import] #fastly #terraform #go #import

NOTE: these instructions have been genericised from a real example, and so your mileage may vary.

I first create a provider.tf file.

terraform {
  required_providers {
    fastly = {
      source  = "fastly/fastly"
 version = "0.28.2"
@GedowFather
GedowFather / ZabbixSender.py
Created December 7, 2015 06:13
AWS Lambda python script for sending metric value to zabbix.
#
# For sending metric value to zabbix server.
#
# You must create item as "zabbix trapper" on server.
# Because the server must be connected to agent:10050, if it is selected "zabbix agent".
#
# Usage:
# from modules.ZabbixSender import ZabbixSender
# ZABBIX_HOST = "zabbix.example.com"
# ZABBIX_PORT = 10051
@ryanray
ryanray / aws-api-gateway-form-to-json.ftl
Created October 4, 2015 01:24
API Gateway application/www-form-urlencoded to application/json based on https://forums.aws.amazon.com/thread.jspa?messageID=673012&tstart=0#673012
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
@halberom
halberom / custom.py
Last active September 15, 2017 07:31
ansible - jinja filter for dict merging
from jinja2.utils import soft_unicode
def merge_dicts(value, dict1):
# return a merged dict
result = {}
result.update(value)
result.update(dict1)
return result
class FilterModule(object):
@floriankraft
floriankraft / JcrQueryLibrary.md
Last active September 11, 2024 15:25
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path

@Zearin
Zearin / python_decorator_guide.md
Last active November 15, 2024 16:12
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].