Skip to content

Instantly share code, notes, and snippets.

View Beomi's full-sized avatar

Junbum Lee Beomi

View GitHub Profile
import binascii
from datetime import datetime
def chunkstring(string, length):
return (string[0+i:length+i] for i in range(0, len(string), length))
# Open in binary mode (so you don't read two byte line endings on Windows as one byte)
# and use with statement (always do this to avoid leaked file descriptors, unflushed files)
with open('hexdata.txt', 'r') as f:
@Beomi
Beomi / deploy.json
Last active April 25, 2020 13:30
DjangoGirls Tutorial Seoul Workshop fabric3 : fabfile.py
{
"REPO_URL":"깃헙Repo주소",
"PROJECT_NAME":"프로젝트폴더(settings.py가있는 폴더)의 이름",
"REMOTE_HOST":"여러분이 만든 도메인주소(ex: djangogirls-seoul-tutorial.tk )",
"REMOTE_USER":"django",
"STATIC_ROOT":"static",
"STATIC_URL":"static",
"MEDIA_ROOT":"media"
}
# parser.py
import requests
# 로그인할 유저정보를 넣어주자 (모두 문자열)
LOGIN_INFO = {
'email': '[email protected]',
'pw': 'aaa124',
'proc': 'login',
'returnUrl': '',
'witnessMe': '1'
@Beomi
Beomi / cap.sh
Last active March 26, 2017 15:41
Upload capture for GoogleDrive
#!/bin/bash
# 1st Install https://github.com/prasmussen/gdrive
# then use this script in Alfred or from CLI when you want to screenshot then upload to your gdrive
# then share the link to others from your paste board
# (run gdrive one first time to authenticate with Google)
screencapture -tpng -i /tmp/temp_shot_gdrive.png
DATEFILENAME=`date +"%Y%m%d%H%M"`
# use -p id to upload to a specific folder
@Beomi
Beomi / deploy.json
Last active March 19, 2017 14:29
Fabric for Django Deploy
{
"REPO_URL":"",
"PROJECT_NAME":"",
"REMOTE_HOST_SSH":"",
"REMOTE_HOST":"",
"REMOTE_USER":"",
"REMOTE_PASSWORD":""
}
@Beomi
Beomi / auth.py
Created February 18, 2017 09:43
class MyUserAuthBackend(object):
def check_legacy_password(self, db_password, supplied_password):
return constant_time_compare('*'+ hashlib.sha1(hashlib.sha1(supplied_password.encode('utf-8')).digest()).hexdigest().upper(), db_password)
def authenticate(self, username=None, password=None):
""" Authenticate a user based on mb_id as the user name. """
try:
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from pandas_datareader import data as web
import time
start_time = time.time()
# encryption.py
def 시프트(입력, 횟수):
알파벳 = 'abcdefghijklmnopqrstuvwxyz'
결과 = ''
for 원래알파벳 in 입력:
숫자알파벳 = 알파벳.index(원래알파벳)
변환알파벳 = 알파벳[(숫자알파벳+횟수)%26]
print(원래알파벳+'-->'+변환알파벳)
@Beomi
Beomi / settings.py
Created September 28, 2016 11:56
Using Gnuboard DB with Django custom AUTH_USER_MODEL
import os
import json
from django.core.exceptions import ImproperlyConfigured
# some settings
# ...
# ...
INSTALLED_APPS = [
@Beomi
Beomi / auth.py
Created September 28, 2016 11:54
Using Gnuboard DB with Django custom AUTH_USER_MODEL
from django.utils.crypto import constant_time_compare
import hashlib
from .models import G5Member as User
class MyUserAuthBackend(object):
def check_legacy_password(self, db_password, supplied_password):
return constant_time_compare('*'+ hashlib.sha1(hashlib.sha1(supplied_password.encode('utf-8')).digest()).hexdigest().upper(), db_password)