Skip to content

Instantly share code, notes, and snippets.

Lukas Stabe ahti

Block or report user

Report or block ahti

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
View sliding_window.swift
struct SlidingWindowView<C: RandomAccessCollection>: RandomAccessCollection {
enum EndBehavior {
case stop
case truncate
}
let base: C
let windowSize: Int
let stepSize: Int
let endBehavior: EndBehavior
@ahti
ahti / mp3.tcl
Last active Aug 9, 2018
Hex Fiend binary template to read mp3 frames, very rough and needs hexf>=2.10
View mp3.tcl
# This is a binary template for inspecting mp3 files in HexFiend
# http://ridiculousfish.com/hexfiend/
#
# https://www.mp3-tech.org/programmer/frame_header.html
# http://id3.org/id3v2.3.0
set count 0
proc : {args} {lindex $args 0}
View PKGBUILD
p=$(cd ../swift; pwd)
pkgname=swift-git
pkgver=$(cd $p/swift; git describe | tr - _)
pkgrel=1
pkgdesc="Swift git builds."
arch=('x86_64')
url="https://swift.org"
license=('apache')
depends=('python2' 'python2-six' 'libutil-linux' 'icu' 'libbsd' 'libedit' 'libxml2' 'sqlite' 'ncurses' 'libblocksruntime')
makedepends=()
View err-336230bea9ed7052d3bc75715bc4d627.demangled
#0 PrintStackTraceSignalHandler(void*) (/usr/bin/swift+0x3f778d4)
#1 llvm::sys::RunSignalHandlers() (/usr/bin/swift+0x3f756ec)
#2 $SignalHandler(int) (/usr/bin/swift+0x3f77a92)
#3 _restore_rt (/usr/lib/libpthread.so.0+0x11a80)
#4 generic specialization <Swift.Int, Foundation.URLSessionTask> of Swift._VariantDictionaryBuffer.ensureUniqueNativeBuffer(withBucketCount: Swift.Int) -> (reallocated: Swift.Bool, capacityChanged: Swift.Bool) (/usr/lib/swift/linux/libFoundation.so+0x6f25ab)
#5 generic specialization <Swift.Int, Foundation.URLSessionTask> of Swift._VariantDictionaryBuffer.nativeRemove(at: Swift._NativeDictionaryIndex<A, B>) -> (key: A, value: B) (/usr/lib/swift/linux/libFoundation.so+0x6f1a99)
#6 Foundation.URLSession._TaskRegistry.remove(Foundation.URLSessionTask) -> () (/usr/lib/swift/linux/libFoundation.so+0x6edf77)
#7 partial apply forwarder for closure #3 () -> () in Foundation._ProtocolClient.urlProtocolDidFinishLoading(Foundation.URLProtocol) -> () (/usr/lib/swift/linux/libFoundation.so+0x
@ahti
ahti / qalc.swift
Last active May 16, 2018
A script for an Alfred qalc workflow
View qalc.swift
#!/usr/bin/env bash
/*/../usr/bin/true
source="$0"
compiled="$0".cache
if [[ "$source" -nt "$compiled" ]]; then
swiftc "$source" -o "$compiled" || exit
fi
"$compiled" "$@"
exit
*/
View simd.swift
// this needs to run with the `-parse-stdlib` command line option passed to swift:
// swift -parse-stdlib simd.swift
import Swift //Import swift stdlib
struct DoubleX4 {
var _v: Builtin.Vec4xFPIEEE64
subscript(_ idx: Int32) -> Double {
@_transparent
get {
View generic_property.swift
struct Property<T> {
let name: String
}
extension Property {
static var someBool: Property<Bool> { return Property<Bool>(name: "bool") }
static var someString: Property<String> { return Property<String>(name: "lol") }
}
struct Foo {
View bind.patch
diff --git a/include/lldb/Utility/TaskPool.h b/include/lldb/Utility/TaskPool.h
index db15b2081..3e6d5df8f 100644
--- a/include/lldb/Utility/TaskPool.h
+++ b/include/lldb/Utility/TaskPool.h
@@ -33,6 +33,7 @@
#include <queue>
#include <thread>
#include <vector>
+#include <functional>
View gist:e1d7538cb1e0a8359d724f69dfa5fb59
> choco install -debug -verbose -y mpv.portable
Chocolatey is running on Windows v 6.3.9600.0
Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
Command line: "C:\ProgramData\chocolatey\choco.exe" install -debug -verbose -y mpv.portable
Received arguments: install -debug -verbose -y mpv.portable
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
You can’t perform that action at this time.