This script reads /tmp/input.wav
, applies the low-pass filter, and writes the modified signal as /tmp/output.wav
.
To run, open Terminal.app and hit the following command:
$ swift main.swift
// Example of wrapping `UIApplication.keyboardDidShowNotification` payload | |
struct KeyboardDidShowPayload { | |
let keyboardFrameBegin: CGRect? | |
let keyboardFrameEnd: CGRect? | |
} | |
extension NotificationWrapper where Payload == KeyboardDidShowPayload { | |
@MainActor static let keyboardDidShow: Self = .init( | |
name: UIApplication.keyboardDidShowNotification, |
extension UIColor { | |
/// Blends this color into the specified color, as if this color was overlaid on top of the other at the specified alpha, but our result will instead be opaque. For instance if self was green, and we passed white and 0.1 alpha/opacity, the result would be a light, faded green. | |
/// | |
/// - Note: This process is also called alpha compositing. | |
func blend(intoColor otherColor: UIColor, atOpacity alpha: CGFloat) -> UIColor { | |
let sourceRGB = rgb | |
let otherRGB = otherColor.rgb | |
return UIColor( | |
red: (sourceRGB.red * alpha) + (otherRGB.red * (1.0 - alpha)), |
// by dave | |
float[][] result; | |
float t, c; | |
float ease(float p) { | |
p = c01(p); | |
return 3*p*p - 2*p*p*p; | |
} | |
float ease(float p, float g) { |
// by dave @beesandbombs | |
int[][] result; | |
float t, c; | |
float ease(float p) { | |
return 3*p*p - 2*p*p*p; | |
} | |
float ease(float p, float g) { |
// | |
// Lightweight but powerful state machine. | |
// | |
// Usage: | |
// enum TrafficLight: State { | |
// case red, orange, green | |
// } | |
// | |
// var trafficLights = StateMachine<TrafficLight>(initialState: .red) | |
// trafficLights.addRoute(from: .red, to: .green) |
//Protocal that copyable class should conform | |
protocol Copying { | |
init(original: Self) | |
} | |
//Concrete class extension | |
extension Copying { | |
func copy() -> Self { | |
return Self.init(original: self) | |
} |
#import <Foundation/Foundation.h> | |
int main (int argc, const char **argv) { | |
@autoreleasepool { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
dispatch_sync(dispatch_get_main_queue(), ^{ | |
NSLog(@"is main thread? %i", (int)[NSThread isMainThread]); | |
}); | |
}); |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<array> | |
<dict> | |
<key>shortcut</key> | |
<string>:smile:</string> | |
<key>phrase</key> | |
<string>😄</string> | |
</dict> |
# psg NAME | |
function psg { | |
processes=$(pgrep $@) | |
if [ -z "$processes" ]; then | |
echo "No matches" | |
else | |
ps $processes | |
fi | |
} |