Skip to content

Instantly share code, notes, and snippets.

View minhoryang's full-sized avatar
😍
Happy Today!

Minho Ryang minhoryang

😍
Happy Today!
View GitHub Profile
#!/usr/bin/env python
import subprocess
import sys
import os
import threading
import random
def stdinreader():
while True:
@varemenos
varemenos / 1.README.md
Last active April 4, 2025 03:30
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit

Promise, async / await

안녕하세요, 이번 아는만큼 세미나에서는 블로킹과 논블로킹의 차이, 그리고 논블로킹의 콜백 지옥에 대해서 알아본 뒤, 콜백 지옥을 탈출할 수 있도록 돕는 Promise 객체와 async / await 문법을 살펴보겠습니다.

블로킹, 논블로킹

function blocking_wait(sec, callback) {
    var start_time = +new Date;
    while (+new Date < (start_time + sec * 1000));
    callback();
}
@mbalex99
mbalex99 / gist:8802db1695f20c520ca0
Last active May 22, 2022 11:58
Alamofire and RxSwift
let rx_request = Observable<Value>.create { (observer) -> Disposable in
let requestReference = Alamofire.request(.POST, url, parameters: payload)
.responseJSON(completionHandler: { (response) in
if let value = response.result.value {
observer.onNext(value)
observer.onCompleted()
}else if let error = response.result.error {
observer.onError(error)
}
})
@devxoul
devxoul / CGFloatLiteral.swift
Created June 29, 2015 09:01
CGFloatLiteral
The MIT License (MIT)
Copyright (c) 2015 Suyeol Jeon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@joakin
joakin / remoties-notes.md
Created June 16, 2015 07:43
We're all remoties notes
  • Seeing a lot of faces/facial expressions is very useful
  • A/V meetings are faster than audio-only conf calls
  • Proper office space and separation helps
  • Use calendar for meeting. Block your busy times.
  • Default to muted if there's unexpected sounds around (kids, pets, etc)
  • Meetings
    • Aggressively limit them
      • 18people 14cities nonadjacent timezones with only 3 meetings (30m) a week everybody was up to date, finished by mid day ¿tuesday?
  • How:
@droxer
droxer / data-container.sh
Created June 10, 2015 01:07
Docker data only container backup/restore
# backup
docker run --volumes-from mongodata -v $(pwd):/backup busybox tar cvf /backup/backup.tar /data/db
# restore
docker run --volumes-from mongodata -v $(pwd):/backup busybox tar xvf /backup/backup.tar
# Dockerfile
FROM centos
@lapause
lapause / example.py
Created June 9, 2015 19:05
Quick and dirty click exceptions handling for translation with gettext
import re
import click
# (1) My gettext helpers are _() and _n(), replace them by yours if necessary.
# (2) I've used the exact same messages in translations, you can adapt them.
def translate_click_exception(e):
"""
Analyse a click exception, translate its message using gettext
and re-raise it in current language.
@Lukasa
Lukasa / README.md
Created June 1, 2015 13:42
Basic Twisted HTTP/2 client.

Simple Twisted H2 Client

This gist contains a really stupid implementation of a Twisted HTTP/2 client. It opens a connection, uses ALPN/NPN to negotiate HTTP/2, and then sends a single HTTP/2 GET request to the /ip endpoint.

To execute this:

  1. Create a clean virtual environment.
  2. Install the requirements: pip install -r requirements.txt.
  3. Install the development version of Twisted that contains the nextProtocols code.
  4. Execute the code using python h2test.py.
@ncerezo
ncerezo / FileUploader.swift
Last active November 30, 2022 03:17
Alamofire multipart upload
//
// FileUploader.swift
//
// Copyright (c) 2015 Narciso Cerezo Jiménez. All rights reserved.
// Largely based on this stackoverflow question: http://stackoverflow.com/questions/26121827/uploading-file-with-parameters-using-alamofire/28467829//
import Foundation
import Alamofire
private struct FileUploadInfo {