Skip to content

Instantly share code, notes, and snippets.

@wys1203
wys1203 / .eslintrc.js
Created April 13, 2024 07:53
nuxtjs3 configs
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module'
},

Keybase proof

I hereby claim:

  • I am wys1203 on github.
  • I am wys1203 (https://keybase.io/wys1203) on keybase.
  • I have a public key ASA-5u7m2IhArFdINjlsspcIDV_KTuZqAuruzz7uGQBeKgo

To claim this, I am signing this object:

@wys1203
wys1203 / aws_cloudwatch_alarm_rename.py
Last active August 24, 2022 11:56
AWS CloudWatch alarm rename script
import sys
import boto3
def rename_alarm(alarm_name, new_alarm_name):
client = boto3.client('cloudwatch')
alarm = client.describe_alarms(AlarmNames=[alarm_name])
if not alarm:
raise Exception("Alarm '%s' not found" % alarm_name)
alarm = alarm['MetricAlarms'][0]
@wys1203
wys1203 / configure_proxy_protocol.md
Created February 21, 2017 13:50 — forked from pablitoc/configure_proxy_protocol.md
Configuring Proxy Protocol

##Install AWS CLI Tools##

  1. Install AWS CLI Tools. You can also use the EC2 API Tool if you are more comfortable with them. But this write-up uses the EC2 CLI.
  2. Create a user via Amazon IAM or download the security accessID and securitykey you will need it to query Amazon CLI.
  3. using Terminal cd into .aws directory cd ~/.aws edit or create new file named config paste the following contents inside.
    `[default]`
    `aws_access_key_id = ACCESS_ID`
    `aws_secret_access_key = SECRET_ID`
    `output = json OR bson OR text`
    `region = PREFERRED_AWS_REGION`

Save the file as "config"

# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import, division
from django.conf import settings
from multiprocessing import Lock
from pymongo import MongoClient
import six
__all__ = ["MongoDB"]
@wys1203
wys1203 / singleton.py
Created June 2, 2016 10:06 — forked from sodastsai/singleton.py
Python singleton metaclass (thread-safe)
from __future__ import absolute_import, division, print_function, unicode_literals
from multiprocessing.dummy import Pool as ThreadPool
from multiprocessing import Lock
from threading import get_ident
class SingletonType(type):
def __new__(mcs, name, bases, attrs):
# Assume the target class is created (i.e. this method to be called) in the main thread.