Skip to content

Instantly share code, notes, and snippets.

François Lamboley Frizlab

  • Frost Land
  • Paris, France
Block or report user

Report or block Frizlab

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
@Frizlab
Frizlab / UUID+Parsing.swift
Created Dec 2, 2016
Date from UUID in Swift
View UUID+Parsing.swift
/* From https://www.famkruithof.net/guid-uuid-make.html
 * and https://www.famkruithof.net/guid-uuid-timebased.html */
extension UUID {
var isTimeUUID: Bool {
return (uuid.8 & 0xC0) == 0x80 /* Variant is the one we expect */ && (uuid.6 & 0xF0) == 0x10 /* Time-based version of the variant */
}
var generationDate: Date? {
View channel.swift
/* Playground - noun: a place where people can play */
/* This test does nothing in the playground. Not sure why it does not work, but
* I'm not that surprised it doesn't. */
import Foundation
class Channel<T> {
@Frizlab
Frizlab / set_sound_volume.sh
Last active Sep 7, 2017
A small shell script that can be used on macOS to change the sound volume from the Terminal. Requires bc (should be built-in on macOS).
View set_sound_volume.sh
#!/bin/bash
if [ -z "$1" -o "$1" -lt 0 -o "$1" -gt 100 ]; then
echo "Usage: $0 new_volume" >/dev/stderr
echo " new_volume must be between 0 and 100" >/dev/stderr
exit 1
fi
new_volume="$(echo "($1 * 8) / 100" | bc)"
osascript -e "tell application \"System Events\" to set volume $new_volume"; # Max is 8, min is 0
You can’t perform that action at this time.