The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"price": "USD 4.99", | |
"dollars": "4.99", | |
"country": "Algeria", | |
"countryCode": "DZA", | |
"link": "https://www.spotify.com/dz-fr/premium/", | |
"percentageOfUSA": 49, | |
"discount": 51 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cfg, err := external.LoadDefaultAWSConfig() | |
if err != nil { | |
panic(err) | |
} | |
esCfg := elasticsearch.Config{ | |
Transport: &awssigner.V4Signer{ | |
RoundTripper: http.DefaultTransport, | |
Credentials: cfg.Credentials, | |
Region: cfg.Region, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CGDirectDisplayID { | |
func getIOService() -> io_service_t { | |
var serialPortIterator = io_iterator_t() | |
var ioServ: io_service_t = 0 | |
let matching = IOServiceMatching("IODisplayConnect") | |
let kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, matching, &serialPortIterator) | |
if KERN_SUCCESS == kernResult && serialPortIterator != 0 { | |
ioServ = IOIteratorNext(serialPortIterator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
# Largely copied from http://www.mathewinkson.com/2015/03/delete-old-tweets-selectively-using-python-and-tweepy | |
# However, Mathew's script cannot delete tweets older than something like a year (these tweets are not available from the twitter API) | |
# This script is a complement on first use, to delete old tweets. It uses your twitter archive to find tweets' ids to delete | |
# How to use it : | |
# - download and extract your twitter archive (tweet.js will contain all your tweets with dates and ids) | |
# - put this script in the extracted directory | |
# - complete the secrets to access twitter's API on your behalf and, possibly, modify days_to_keep | |
# - delete the few junk characters at the beginning of tweet.js, until the first '[' (it crashed my json parser) | |
# - review the script !!!! It has not been thoroughly tested, it may have some unexpected behaviors... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class Hasher { | |
fun hash(): String { | |
val bytes = this.toString().toByteArray() | |
val md = MessageDigest.getInstance("SHA-256") | |
val digest = md.digest(bytes) | |
return digest.fold("", { str, it -> str + "%02x".format(it) }) | |
} | |
} |
How to make an application icon for macOS using
iconset
&iconutil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
_____ _____ _ | |
| __ \ / ____| | | | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __ | |
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__| | |
| |__| | __/ |____| | | |_| | |_) | || (_) | | | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_| | |
__/ | | | |
|___/|_| | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
fileprivate protocol Statelike { | |
var stateMachine: StateMachine { get } | |
func logIn() | |
func logOut() | |
} | |
extension Statelike { | |
func logIn() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "bytes" | |
func StreamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
func StreamToString(stream io.Reader) string { | |
buf := new(bytes.Buffer) |
NewerOlder