Skip to content

Instantly share code, notes, and snippets.

View kkd927's full-sized avatar
🇰🇷

KyoungDeok Kwon kkd927

🇰🇷
View GitHub Profile
@kkd927
kkd927 / Installation.md
Created January 19, 2018 02:42 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@kkd927
kkd927 / Matrix.java
Created January 15, 2018 01:58 — forked from benelog/Matrix.java
나선형배열 문제
package problems;
import static java.util.Arrays.*;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;
/**
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <YOUR@EMAIL.KAPPA> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j
@kkd927
kkd927 / IntersectionType.java
Created November 30, 2017 07:30
람다와 인터섹션 타입을 이용한 동적인 기능확장법
import java.util.function.Consumer;
import java.util.function.Function;
/**
* @see <a href="https://www.youtube.com/watch?v=PQ58n0hk7DI">토비의 봄 TV 4회 (2) Generics에서 와일드카드 활용법, 람다와 인터섹션 타입을 이용한 동적인 기능확장법</a>
*/
public class IntersectionType {
interface Pair<T> {
T getFirst();
T getSecond();
{
"lotto":{
"lottoId":5,
"winning-numbers":[2,45,34,23,7,5,3],
"winners":[
{
"winnerId":23,
"numbers":[2,45,34,23,3,5]
},
{
@kkd927
kkd927 / big_int.c
Created October 17, 2015 15:27
Structure for Big Integer
struct BIG_INT {
unsigned char *ptr; // 저장 공간의 주소 저장
int size; // 저장 공간의 크기 저장
bool sign; // 부호 저장(true: 음수, false: 양수)
}
@kkd927
kkd927 / index.html.erb
Created June 25, 2015 19:38
Rails Ajax - index.html.erb
<div id="users">
<%= render @user %>
</div>
@kkd927
kkd927 / gist:1ba6c09f833c20260033
Created September 7, 2014 12:56
upload video with paperclip (reports_controller.rb)
# POST /reports
# POST /reports.json
def create
@report = current_user.reports.build(report_params)
respond_to do |format|
if @report.save
format.html { redirect_to @report, notice: 'Report was successfully created.' }
else
format.html { render action: 'new' }
@kkd927
kkd927 / gist:ff374bde1d1949717a90
Created September 7, 2014 12:48
In app/models/report.rb
has_attached_file :video,
:path => ":rails_root/public/video/:id/:filename",
:url => "/video/:id/:filename",
:styles => {
:medium => { :geometry => "640x480", :format => 'mp4' },
:large => { :geometry => "1024x576", :format => 'mp4' },
},
:processors => [:ffmpeg, :qtfaststart]
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
@kkd927
kkd927 / gist:9716045798fa46bb80cf
Created September 2, 2014 01:45
Installing Sublime Text 2 on Linux (Ubuntu)
$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
$ sudo apt-get update
$ sudo apt-get install sublime-text