Skip to content

Instantly share code, notes, and snippets.

View HwDhyeon's full-sized avatar
💭
😀

황동현 HwDhyeon

💭
😀
View GitHub Profile
@HwDhyeon
HwDhyeon / paramiko_pem.py
Last active March 2, 2020 00:50
paramiko 모듈과 .pem 파일을 이용해 서버에 접속하기
# -*- coding: utf-8 -*-
import paramiko
PRIVATE_KEY = paramiko.RSAKey.from_private_key_file(filename=FILENAME)
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=HOSTNAME, username=USERNAME, pkey=PRIVATE_KEY)
@HwDhyeon
HwDhyeon / DockerHub.sh
Last active March 9, 2020 06:37
DockerHub에 이미지 푸시하고 풀 받기
# DockerHub 로그인
docker login --username {Dockerhub Username} --password {DockerHub Access token}
(= docker login -u {Dockerhub Username} -p {DockerHub Access token})
# 컨테이너를 이미지화 해서 DockerHub에 커밋
docker commit {Container Name} {DockerHub Username}/{Image Name}:{Tag (e.g., latest)}
# DockerHub에 이미지 푸시
docker push {DockerHub Username}/{Image Name}:{Tag (e.g., latest)}
@HwDhyeon
HwDhyeon / timeoutInPython.py
Created March 2, 2020 05:01
Python multiprocessing 모듈을 이용해 타임아웃 구현하기
from multiprocessing import Process
import time
import sys
TIMEOUT = 5
def tenSecond():
for i in range(10):
@HwDhyeon
HwDhyeon / indeed-scrapper.go
Last active March 6, 2020 05:15
goroutine을 이용해 동시에 웹 페이지 스크랩하기
package main
import (
"encoding/csv"
"fmt"
"log"
"net/http"
"os"
"strconv"
"strings"
@HwDhyeon
HwDhyeon / ssh_client.go
Created March 6, 2020 05:14
ssh 모듈을 이용해 ssh 서버 생성하기
package main
import (
"time"
"github.com/gliderlabs/ssh"
)
func main() {
MaxTimeout := time.Second * 20
@HwDhyeon
HwDhyeon / check_parameter.Jenkinsfile
Created March 11, 2020 00:30
젠킨스 빌드 시 파라미터가 존재하는지 확인하고 없다면 기본값 설정하기
def MY_VARIABLE = null
if(env.my_parameter) {
MY_VARIABLE = env.my_parameter
} else {
MY_VARIABLE = "default value"
}
echo "parameter set: ${MY_VARIABLE}"
@HwDhyeon
HwDhyeon / easy_ssh_client.go
Last active November 29, 2023 01:49
SSH Client를 Go로 쉽게 구현하기
package main
import (
"fmt"
"io/ioutil"
"log"
"net"
"time"
"golang.org/x/crypto/ssh"
@HwDhyeon
HwDhyeon / deleteBranch
Created April 16, 2020 06:19
git branch를 삭제하고 github에 반영하기
git branch --delete(-D) [branch name]
git push origin :[branch name]
@HwDhyeon
HwDhyeon / deletePush
Created April 28, 2020 07:52
가장 최근에 원격저장소에 올라간 푸시기록 삭제하기
> git reset HEAD^
More? ^
> git push --force
@HwDhyeon
HwDhyeon / average.c
Created June 3, 2020 05:54
무한정 정수를 입력받고 평균을 구하기 (realloc 활용)
#include <stdio.h>
#include <stdlib.h>
// Integer data define
typedef struct Data Data;
struct Data {
int num;
};
// Integer data control functions