Skip to content

Instantly share code, notes, and snippets.

View qlawmarq's full-sized avatar
🏠
Working from home

Masaki Yoshiiwa qlawmarq

🏠
Working from home
View GitHub Profile
@qlawmarq
qlawmarq / hi.gif
Last active February 8, 2022 02:10
hi
hi.gif
@qlawmarq
qlawmarq / how_to_setup_mac_for_dev.md
Last active November 30, 2022 02:49
How to setup Mac PC for developer

How to setup Mac PC for developer

Install Homebrew

Homebrew installs tools you need that Apple didn’t.

https://brew.sh

@qlawmarq
qlawmarq / How_to_switch_between_multiple_GitHub_accounts_via_ssh.md
Last active February 22, 2022 05:31
How to switch between multiple GitHub accounts via ssh

How to switch between multiple GitHub accounts via ssh

Generate a new SSH key

Open Terminal, and create SSH keys for each accounts.

ssh-keygen -t ed25519 -C "your_email@example.com"
@qlawmarq
qlawmarq / Requirements_for_the_assignment.md
Last active February 22, 2022 07:43
Coding Test for Frontend dev

Coding Test for Frontend dev

Requirements

We need basic registration web page

  • Use Git for version control, and use any Git repository for sharing code.
  • Use TypeScript.
    • Minimize the use of any type.
  • Use any SPA framework, React or its extension frameworks (such as Next.js) is preferred.
@qlawmarq
qlawmarq / drop_columns_with_constraints.sql
Created May 26, 2022 06:52
Delete/drop columns with foreign key constraints or default values constraints in SQL server.
-- Search default value constraints:
SELECT
obj.name
FROM
sys.objects AS obj
JOIN
sys.columns AS clm ON obj.object_id = clm.default_object_id
WHERE
obj.type = 'D' AND obj.parent_object_id = OBJECT_ID('User') AND clm.name = 'CompanyId';
@qlawmarq
qlawmarq / cloud-sql-python-connector-with-pytds-for-sql-server.py
Last active October 26, 2022 01:23
Example of using PyTDS and Cloud SQL Python Connector to connect SQL server of Cloud SQL
from google.cloud.sql.connector import Connector, IPTypes
import pytds
import os
##### SQL connecter #############################################
#################################################################
# Grabbing the user and password from environment variables
db_name = os.getenv("APPLICATION_DB")
@qlawmarq
qlawmarq / memorize.py
Created October 26, 2022 01:28
Memorize function for Python
import os
from uuid import uuid4
##### Memorize function for performance ###################
#################################################################
def get_id_tuple(f, args, kwargs, mark=object()):
l = [id(f)]
for arg in args:
l.append(id(arg))
@qlawmarq
qlawmarq / google_app_engine_deployer.yml
Last active December 18, 2023 02:41
GitHub Actions: Deployer for Node.js app to Google App Engine
name: Deployer
#####
#
# Add this file to .github/workflows/google_app_engine_deployer.yml, then GitHub Actions will detect any updates on master/main branch and deploy changes.
# This example uses Node.js 18. You can choose any language you like.
# The build command is also `npm run build', change it as you like.
#
# 1. Set up service account for deployment and create key.json and set it to env variable
# 2. Create your app.yaml if you never deploy the app to GAE
@qlawmarq
qlawmarq / delete-old-gae.yml
Last active February 22, 2023 03:25
Remove old versions of Google App Engine with GitHub Actions
name: Remove old versions of Google App Engine
#####
#
# Add this file to .github/workflows/delete-old-gae.yml then GitHub Actions will remove old versions of Google App Engine.
#
#####
on:
workflow_dispatch:
@qlawmarq
qlawmarq / generate_random_string.py
Created February 28, 2023 01:39
Generate Random Strings and Passwords in Python
import random
import string
def generate_random_string():
selects = random.sample(string.ascii_uppercase, 3) + random.sample(
string.digits, 3) + random.sample(string.ascii_lowercase, 3)
random.shuffle(selects)
unique_code = ''.join(selects)
print(unique_code)
return unique_code