This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # $ ./extract-bbox.py --zipfile OxedOSM_USA_0-13.zip --depth 13 --center-lat 37.123456 --center-lon -122.876543 --radius 10 | |
| import os | |
| import zipfile | |
| import argparse | |
| from math import floor, pi, tan, cos, log |
This file contains hidden or 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
| su # Run the following commands as root | |
| echo "deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main | |
| deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main" > /etc/apt/sources.list.d/ethereum-bioinc.list | |
| apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9 | |
| apt-get update | |
| apt-get install ethereum | |
| # Taken from https://linuxconfig.org/ethereum-mining-on-ubuntu-18-04-and-debian | |
| # GETH Manual does not explicitly mention Debian and Ubuntu method is failing https://geth.ethereum.org/docs/install-and-build/installing-geth |
This file contains hidden or 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 Cocoa | |
| import AVFoundation | |
| // inspiration: https://www.youtube.com/watch?v=1_PUdhLQsZQ | |
| class ViewController: NSViewController { | |
| @IBOutlet weak var videoView: NSView! | |
| private var cameraSession = AVCaptureSession() | |
| private var camera: AVCaptureDevice! |
NB: This will not work for instances that proxy outgoing requests!
I wanted to find a way to detect the real IP address of a Mastodon/Pleroma/Misskey/etc instance hosted behind Cloudflare. How to do that? Well, it's federated, which means I can probably get it to send a request to a server of mine! And how to do that? I tried reading the ActivityPub spec. The following caught my attention:
Servers should not trust client submitted content, and federated servers also should not trust content received from a server other than the content's origin without some form of verification.
This file contains hidden or 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
| private let audioOutput: AVCaptureAudioPreviewOutput = { | |
| let audioOutput = AVCaptureAudioPreviewOutput() | |
| audioOutput.volume = UserDefaults.standard.volume | |
| struct Device { | |
| var name: String? | |
| var uid: String? | |
| } | |
| var devicesProperty = AudioObjectPropertyAddress(mSelector: kAudioHardwarePropertyDevices, mScope: kAudioDevicePropertyScopeOutput, mElement: kAudioObjectPropertyElementWildcard) | |
| var devicesSize: UInt32 = 0 |
This file contains hidden or 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 | |
| import AVFoundation | |
| @objc | |
| protocol CameraCaptureDelegate: class { | |
| func captureVideoOutput(sampleBuffer: CMSampleBuffer) | |
| @objc optional func captureAudioOutput(sampleBuffer: CMSampleBuffer) | |
| } | |
| class CameraManager: NSObject { |
This file contains hidden or 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 UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| let window = UIWindow(frame: UIScreen.main.bounds) |
This file contains hidden or 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
| ## OS X files | |
| .DS_Store | |
| .DS_Store? | |
| .Trashes | |
| .Spotlight-V100 | |
| *.swp | |
| ## Xcode build files | |
| DerivedData/ | |
| build/ |
This file contains hidden or 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
| // Returns a random Emoji 🌿 | |
| extension String{ | |
| func randomEmoji()->String{ | |
| let range = 0x1F601...0x1F64F | |
| let ascii = range.startIndex + Int(arc4random_uniform(UInt32(range.count))) | |
| let emoji = String(UnicodeScalar(ascii)) | |
| return emoji | |
| } | |
| } |
NewerOlder