Skip to content

Instantly share code, notes, and snippets.

@kangkyu
kangkyu / response.json
Last active April 25, 2023 22:21
response from a google doc
{
"title": "Title Different",
"body": {
"content": [
{
"endIndex": 1,
"sectionBreak": {
"sectionStyle": {
"columnSeparatorStyle": "NONE",
"contentDirection": "LEFT_TO_RIGHT",
@kangkyu
kangkyu / enclaves.go
Created April 11, 2023 20:49
Leetcode answer (not working)
type Cell struct {
north, east, south, west int
}
func numEnclaves(grid [][]int) int {
// return value of this func
count := 0
// row count
m := len(grid)
@kangkyu
kangkyu / tf-log-trace.txt
Created April 5, 2023 08:41
output of TF_LOG=trace
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
2023-04-05T01:33:47.986-0700 [INFO] backend/local: apply calling Apply
2023-04-05T01:33:47.987-0700 [DEBUG] Building and walking apply graph for NormalMode plan
2023-04-05T01:33:47.987-0700 [TRACE] Executing graph transform *terraform.ConfigTransformer
2023-04-05T01:33:47.987-0700 [TRACE] ConfigTransformer: Starting for path:
@kangkyu
kangkyu / marshal_json.go
Last active June 19, 2019 01:53
json.Marshal
package main
import (
"encoding/json"
"fmt"
)
type person struct {
First string
Last string
@kangkyu
kangkyu / el_capitan_osx.markdown
Last active January 16, 2016 18:22
El Capitan change on macOS X
  1. install command-line tool matching OS X version
  2. homebrew / npm
sudo chown -R $(whoami):admin /usr/local
  1. eventmachine
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" gem install eventmachine
@kangkyu
kangkyu / exercism_osx.markdown
Last active January 16, 2016 18:15
Setup exercism.io in macOS X
  1. go to exercism.io and login with github account
  2. get your api key (navbar > username > api key)
  3. install exercism brew install exercism in OSX
  4. and set api key to exercism cli http://exercism.io/cli
@kangkyu
kangkyu / mixin_module.rb
Last active November 15, 2015 23:08
Today's Kata 11-13-2015
=begin
# Question 1. A mixin is a module whose methods you want to use in more than one class. One popular interview question is: How do you use module methods as class methods, and how to you use them as instance methods? In other words, given this module ...
module Mixin
def method1
'method1'
end
end
@kangkyu
kangkyu / random_number.rb
Created November 11, 2015 00:02
Today's Kata 11-10-2015
# add a logger to this class, such that there is only one logger, that writes to a file called ./logfile.txt
class Charlie
class Logger
def self.log(number)
File.open("./logfile.txt", "a") do |f|
f.puts "#{number}"
end
@kangkyu
kangkyu / plus_minus.rb
Last active November 4, 2015 06:57
Today's Kata 11-03-2015
# For today, here's the problem for today
# Do whatever you need to do to Ruby, such that I can say: 9 - 8, and the answer will be 17
# And if I say 9 + 8, the answer will be 1
# so - i load whatever code you want to give me via a console, and I should be able to do the above
# turn plus into minus, minus into plus
# a short sentence explaining what you did and why it works would be nice
class Fixnum
alias_method :temp, :+
alias_method :+, :-
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
def reverse(string)
result = ""
string.length.times do |i|
result = string[i] + result
end
result
end