Skip to content

Instantly share code, notes, and snippets.

View Y4suyuki's full-sized avatar

Yasuyuki Ageishi Y4suyuki

  • USJ LLC
  • Osaka, Japan
View GitHub Profile
@Y4suyuki
Y4suyuki / .tmux.conf
Created November 6, 2022 06:25
google cloud cloud shell tmux setup
# use vim keybindings in copy mode
set-option -g mouse on
setw -g mode-keys vi
set-option -s set-clipboard off
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
set-option -g status on
#!/bin/bash
set -eu
cluster=''
p=''
usage() {
echo "Usage: $0 [-c CLUSTER_NAME] [-p AWS_PROFILE]" 1>&2
}
@Y4suyuki
Y4suyuki / set_default_sink_as_hdmi.sh
Created October 10, 2021 15:53
set default sink as HDMI monitor for pulse audio
#!/bin/bash
index=$(pacmd list-sinks | grep hdmi -B 1 | head -n 1 | cut -d':' -f2)
pacmd set-default-sink "$index"
@Y4suyuki
Y4suyuki / static-site-hosting.yml
Created September 5, 2021 17:25
simple s3 static site hosting cloudformation template
Resources:
S3Bucket:
Type: 'AWS::S3::Bucket'
DeletionPolicy: Retain
Properties:
AccessControl: PublicRead
BucketName: my-static-hosting
WebsiteConfiguration:
IndexDocument: index.html
@Y4suyuki
Y4suyuki / cursor.el
Last active February 5, 2021 01:13
toy elisp for emacs intro lt
;; https://stackoverflow.com/questions/4642835/how-to-change-the-cursor-color-on-emacs
(defvar blink-cursor-colors (list "#92c48f" "#6785c5" "#be369c" "#d9ca65")
"On each blink the cursor will cycle to the next color in this list.")
(setq blink-cursor-count 0)
(defun blink-cursor-timer-function ()
"Zarza wrote this cyberpunk variant of timer `blink-cursor-timer'.
Warning: overwrites original version in `frame.el'.
@Y4suyuki
Y4suyuki / react_usestate.md
Created January 20, 2021 03:55
reseach on calling useState state update function at the top level

You can't call react usestate update function at the top level

const Card: React.FC<{name: string}> = ({ name }) => {
  const [x, setX] = React.useState(0)
  setX(9)
  return <div className="card">
    Hello {name} {x}
  </div>
}
"""
Python module for AWS Step Functions
"""
import copy
from functools import reduce
import json
def to_d(x):
if isinstance(x, SfnBase):
$(cat .Xresource)
String file contents
from datetime import datetime
import boto3
def list_bucket_contents(bucket_name):
"""return a list of contents in a bucket"""
client = boto3.client('s3')
paginator = client.get_paginator('list_objects')
try:
page_iterator = paginator.paginate(Bucket=bucket_name)