Skip to content

Instantly share code, notes, and snippets.

View hongry18's full-sized avatar

hongry hongry18

View GitHub Profile
@hongry18
hongry18 / aes_encrypt.php
Created April 5, 2016 05:21 — forked from kijin/aes_encrypt.php
PHP에서 AES-256과 HMAC을 사용하여 문자열을 암호화하고 위변조를 방지하는 법
<?php
// AES-256과 HMAC을 사용하여 문자열을 암호화하고 위변조를 방지하는 법.
// 비밀번호는 서버만 알고 있어야 한다. 절대 클라이언트에게 전송해서는 안된다.
// PHP 5.2 이상, mcrypt 모듈이 필요하다.
// 문자열을 암호화한다.
function aes_encrypt($plaintext, $password)
{
@hongry18
hongry18 / aes_cipher.py
Created September 28, 2016 06:19 — forked from pankaj28843/aes_cipher.py
Encrypt & Decrypt using PyCrypto AES 256
'''
Based on Stackoverflow Answer: http://stackoverflow.com/a/12525165/353550
'''
import base64
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
func _request(url: String, data: String) -> Void {
var req = URLRequest(url: URL(string: url)!)
req.httpMethod = "POST"
req.httpBody = data.data(using: String.Encoding.utf8)
//let session = URLSession.shared
let session = URLSession(configuration: URLSessionConfiguration.default)
let task = session.dataTask(with: req) {data, response, error in
if error != nil {
@hongry18
hongry18 / pagination.html
Created February 11, 2017 03:09
javascript 10 block paging
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<style>
.pagination {
display: inline-block;
clear: both;
float: right;
@hongry18
hongry18 / openssl.md
Last active December 26, 2017 06:38
openssl.md

openssl

install

linux

  • red hat, centos
    • yum install openssl
  • ubuntu
    • apt-get install openssl
@hongry18
hongry18 / study.way.md
Last active June 23, 2017 01:54
학습방법

학습방식

이 강의를 들으면서 https://www.youtube.com/watch?v=Xcy2Pq6LABk&feature=youtu.be&list=PLqaSEyuwXkSoxouWmQKMHXYDozPiyjNXO

프로그램 학습방식 프로그램에 대해 국한하여

  • 기초부터 쌓은후 만들어가는 방식 대부분의 교육이 그러하다, 당연하다고 생각한다
    • 초중고 12 + 대 4 년동안 목적(만들고 싶은)이 없는 상태에서 지식을 학습하는 것에만 집중
  • 과정을 소화하는 일부 학생에 초점을 맞춘 교육 방식
@hongry18
hongry18 / java.jwt.md
Last active June 27, 2017 07:12
java jwt sample

JWT Sample

reference

https://jwt.io

nodeJS

dependency (npm)

npm install --save express body-parser jsonwebtoken

@hongry18
hongry18 / replace.regex.str.md
Last active November 8, 2017 00:42
replace regular expression String

Replace Regular Expression

Linux Find exec

find ./ -name '*.ext' -exec sed -i '%s/old/new/g' {} ;

find & xargs

find ./ -name '*.ext' | xargs sed -i '%s/old/new/g'

sed include newline

sed ':a;N;$!ba;s/\n/ /g' file

@hongry18
hongry18 / CentOS.firewall.md
Created July 3, 2017 00:45
CentOS Firewall

Firewall Setting

CentOS 6.x

iptables

  • chain
    • input: 들어오는 모든 패킷
    • output: 나가는 모든 패킷
    • forward: 라우터로 사용되는 패킷
  • match
    • --source, -s: 출발지