Skip to content

Instantly share code, notes, and snippets.

Jeongjin Kim kimjj81

Block or report user

Report or block kimjj81

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kimjj81 / SimplePaginator
Created Dec 6, 2019
Paginator for numerous records in Django-admin.
View SimplePaginator
from django.core.paginator import Paginator
class SimpleCountPaginator(Paginator):
def _get_count(self):
first_id = self.object_list.first().id
last_id = self.object_list.last().id
if (first_id is None) or (last_id is None):
return 0
max_id = max(last_id, first_id)
kimjj81 /
Created Nov 6, 2019 — forked from maixuanhan/
Install Ubuntu server 18.04 via USB disk and serial console
public static String makePasswordHash(String text) {
byte[] salt = "yoursalt".getBytes(Charsets.UTF_8);
try {
char[] chars = text.toCharArray();
final int iterations = 10;
// Generate a 256-bit key
final int outputKeyLength = 256;
kimjj81 / PBKDF2.m
Created Apr 30, 2018
PBKDF2 Objective-c
View PBKDF2.m
#import <CommonCrypto/CommonCrypto.h>
+ (NSString*)onewayHash:(NSString *)text {
NSMutableData *key = [NSMutableData dataWithLength:kCCKeySizeAES256];
NSString *password = text;
NSString* saltText = @"salt";
NSData* salt = [saltText dataUsingEncoding:NSUTF8StringEncoding];
int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm
kimjj81 /
Created Apr 30, 2018 — forked from ToastShaman/
A utility class for hashing passwords using PBKDF2 with BouncyCastle.
package com.zuhlke.lsapi;
import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.SHA3Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.prng.DigestRandomGenerator;
import java.util.Base64;
kimjj81 / UInt_extension.swift
Last active Feb 26, 2018
Convert UInt to UInt8(byte) Array in swift.
View UInt_extension.swift
protocol UIntToBytesConvertable {
var toBytes: [UInt8] { get }
extension UIntToBytesConvertable {
func toByteArr<T: BinaryInteger>(endian: T, count: Int) -> [UInt8] {
var _endian = endian
let bytePtr = withUnsafePointer(to: &_endian) {
$0.withMemoryRebound(to: UInt8.self, capacity: count) {
UnsafeBufferPointer(start: $0, count: count)
kimjj81 / Save CGImage
Last active Sep 19, 2017
resize uiimage
View Save CGImage
void CGImageWriteToFile(CGImageRef image, NSString *path) {
CFURLRef url = (__bridge CFURLRef) [NSURL fileURLWithPath:path];
CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, NULL);
CGImageDestinationAddImage(destination, image, nil);
if (!CGImageDestinationFinalize(destination)) {
NSLog(@"Failed to write image to %@", path);
You can’t perform that action at this time.