Skip to content

Instantly share code, notes, and snippets.

View LineByLine.swift
import Foundation
/// Adapted from
extension URL {
/// Note: Only supports newline as the line break character.
func processLineByLine(processLine: @escaping (_ line: String) -> ()) {
JanX2 /
Last active December 10, 2023 04:41 — forked from joeytwiddle/
Add all forks of the current repo as remotes
#!/usr/bin/env bash
set -e
# See also: (same thing but in python)
origin_url="$(git config --get remote.origin.url | sed 's+.*: ++')"
full_repo_name="$(echo "$origin_url" | sed 's+.* ; s+\.git$++')"
JanX2 / 00-dragndrop.swift
Created June 28, 2020 14:52 — forked from erica/00-dragndrop.swift
Building an OSX Drag and Drop Playground: Throw the dragndrop.swift into shared Sources and then test out the examples in individual playgrounds. Make sure the assistant is open and set to the timeline. I prefer vertical assistant stacking for this.
View 00-dragndrop.swift
import Cocoa
// Support Foundation calls on String
public extension String { public var ns: NSString {return self as NSString} }
/// Custom Labeled Playground-Based Drag-and-Drop window
public class DropView: NSTextField {
// Default action handler
public var handler: ([String]) -> Void = { paths in Swift.print(paths) }
JanX2 / gist:317cd8c152732e69f91b96979d8e965b
Last active September 22, 2018 15:14 — forked from cazepeda-zz/gist:8876300
Open Dyslexic Bookmarklet
View gist:317cd8c152732e69f91b96979d8e965b
JanX2 /
Created February 9, 2018 15:59 — forked from geoffwatts/
Read an SDS011 Laser PM2.5 Sensor (Nova PM Sensor) with Python
# -*- coding: UTF-8 -*-
# Requires pyserial. Install via:
# pip install pyserial
from __future__ import print_function
from serial import Serial, EIGHTBITS, STOPBITS_ONE, PARITY_NONE
import time, struct
View rnnoise_vad_demo.c
/* Copyright (c) 2017 Mozilla */
/* Copyright (c) 2017 Jan Weiß */
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
JanX2 /
Last active April 10, 2016 08:34 — forked from fzwo/
Create a complete class-dump of Xcode, ready for adding to an empty Xcode project for all your header-ogling needs.
# Creates a complete class-dump of Xcode and all its libs and internal plug-ins.
# Assumes you have Class-Dump in your path and Xcode at the location set via `xcode-select`.
xcodePath=`xcode-select -p`
sourceXcodeRootPath="$(dirname "$xcodePath")"
echo "Dumping from Xcode: $sourceXcodeRootPath"
JanX2 /
Last active February 7, 2021 12:01 — forked from faithfracture/
Boost build script for iOS (armv7, armv7s, arm64), iOS Simulator (i386, x86_64), and OSX (i386, x86_64)
# Filename:
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
# Builds a Boost framework for iOS, iOS Simulator, and OSX.
# Creates a set of universal libraries that can be used on an iOS and in the
View Type this in front process.applescript
set theString to "Test"
set theseCharacters to characters of theString
tell application "System Events"
delay 2 -- Time to switch, if running from editor. Can be removed, if running from menu.
tell front process
repeat with thisChar in theseCharacters
keystroke (thisChar as text)
delay 0.1