Skip to content

Instantly share code, notes, and snippets.

@ikaruce
ikaruce / add_two_numbers.java
Created May 31, 2021 14:38
LeetCode 2. Add Two Numbers
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
@ikaruce
ikaruce / twosum.java
Last active May 29, 2021 16:18
LeetCode 1. two sum
class Solution {
public int[] twoSum(int[] nums, int target) {
HashMap<Integer, Integer> h = new HashMap<Integer, Integer>();
int i = 0;
for(; i< nums.length; i++){
if(h.get(nums[i]) == null){
h.put(target-nums[i], i);
}else{
break;
@ikaruce
ikaruce / index.html
Last active November 22, 2019 01:55
multiline ellipsis
<html>
<head><title>multiline Ellipses</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"></script>
<style>
.container {
padding: 10px;
FROM ruby:2.6.5
RUN gem install rails
RUN wget https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz && \
tar -xvf node-v10.16.3-linux-x64.tar.xz && \
mv node-v10.16.3-linux-x64 ./bin/nodejs
ENV PATH=/bin/nodejs/bin:$PATH
RUN curl -o- -L https://yarnpkg.com/install.sh | bash
ENV PATH=~/.yarn/bin:$PATH
@ikaruce
ikaruce / 0_Result.txt
Last active April 19, 2016 13:09
Comparison of Input in Java
1. TIME : 214.600077 (ms) via Scanner Only
2. TIME : 70.597856 (ms) via BufferedReader with String split
3. TIME : 76.93713 (ms) via BufferedReader with StringTokenizer
4. TIME : 67.667364 (ms) via Scanner with BufferedReader
When using BufferedReader is faster than when using Scanner only.
and case 4 is most simple to write.
require 'telegram_bot'
bot = TelegramBot.new(token: '193199186:AAFtN0tv35_AUxiWHvQvOQOLw-u-tsGtn6A')
bot.get_updates(fail_silently: true) do |message|
puts "@#{message.from.username}: #{message.text}"
command = message.get_command_for(bot)
message.reply do |reply|
case command
when /greet/i
@ikaruce
ikaruce / addYoutubeInMarkdown.md
Last active March 12, 2023 15:17
Add youtube link with screenshot in markdown.

마크다운 문서에 유튜브 링크 추가하기.

표준 마크다운 문법을 따르는 문서에서는 유튜브에서 제공하는 iframe 태그는 차단됩니다. 그래서 약간의 트릭이 필요합니다. 스크린샷 이미지에 링크를 다는 것이지요.

아래와 같은 방식으로

[![이미지 텍스트](스크린샷 이미지)](유투브링크)

깃헙의 LFS를 설명해 놓은 동영상을 링크를 걸면

@ikaruce
ikaruce / gemfile_download_with_all_dependencies.md
Created February 12, 2015 07:51
Gem file download with all dependencies.

Gem file download with all dependencies.

( 원본 : http://stackoverflow.com/a/9312332/3081313)

인터넷이 연결되지 않은 상태에서 Gem file을 설치하려면 Gem 파일을 다운 받아 --local 옵션을 주어서 설치할 수 있는데, 의존성을 가진 Gem 파일들을 모두 다운 받아야 한다. 몇개 안되는 경우 하나하나 다운받으면 되지만, 의존성이 많은 경우나 의존성을 가진 Gem이 다른 Gem에 또 의존성을 가지는 경우 모두 다운 받으려면 상당히 많은 고통을 준다. 이 글은 이런 경우 의존성을 가지는 Gem들을 bundler를 통해 한꺼번에 다운 받아서 설치할 수 있는 방법을 설명한다.

1. 먼저 인터넷이 연결된 장비에서 새로운 폴더를 생성하고 Gemfile을 생성한다.

$ mkdir tempfolder && cd $_
$ touch Gemfile
@ikaruce
ikaruce / Svn2Git.md
Created February 3, 2015 08:06
SVN에서 Git으로 전환하기(브랜치와 태그 보전하면서)
@ikaruce
ikaruce / .bowerrc
Created December 30, 2014 02:17
bowerrc ( proxy, strict-ssl setting )
{
"proxy":"{proxy_server}:{proxy_port}",
"https-proxy":"{proxy_server}:{proxy_port}",
"strict-ssl":false
}