Skip to content

Instantly share code, notes, and snippets.

@bilalmughal
bilalmughal / ec2_graviton_dl_bootstrap.sh
Last active April 2, 2025 15:29
This script automates the setup of an Amazon EC2 Graviton ARM-based instances for deep learning tasks. It takes care of installing essential utilities, setting up latest Nvidia drivers and CUDA 12.2 toolkit and cuDNN library, and build PyTorch from source. The step-by-step guided can be checked here. https://jumpshare.com/blog/deep-learning-on-a…
#!/bin/bash
set -e # Exit on any error
# Check if required arguments are provided
if [ -z "$REGION" ] || [ -z "$SECURITY_GROUPS" ] || [ -z "$KEY_PAIR" ] || [ -z "$SUBNET" ]; then
echo "Error: You must provide REGION, SECURITY_GROUPS, KEY_PAIR, and SUBNET as environment variables."
echo "Example:"
echo " export REGION=us-east-1"
echo " export SECURITY_GROUPS=sg-12345678,sg-87654321"
echo " export KEY_PAIR=my-key-pair"
@insidegui
insidegui / PlatformViewRepresentable.swift
Created August 10, 2022 18:13
Protocol that automatically adds UIViewRepresentable or NSViewRepresentable conformance to implementers according to the current platform
import SwiftUI
#if os(iOS) || os(tvOS)
public typealias PlatformView = UIView
public typealias PlatformViewRepresentable = UIViewRepresentable
#elseif os(macOS)
public typealias PlatformView = NSView
public typealias PlatformViewRepresentable = NSViewRepresentable
#endif
@nkalvi
nkalvi / NavigationSplitViewExample.swift
Last active November 7, 2024 01:49 — forked from Dimillian/NavigationSplitViewExample.swift
An example on how to use the new NavigationSplitView on iPad with global navigation - updated to work by following "Bringing robust navigation structure to your SwiftUI app"
// 2024-11-06: Simple test based on "Bringing robust navigation structure to your SwiftUI app"
// https://developer.apple.com/documentation/swiftui/bringing_robust_navigation_structure_to_your_swiftui_app
// Xcode Version 16.1, iOS 17+
// Opens to a sheet first instead of NavigationSplitView
import SwiftUI
@main
struct TestSplitViewApp: App {
@apottere
apottere / index.ts
Created February 9, 2022 21:51
How to validate credCert public key matches keyId for Apple iOS AppAttest key verification
import cbor from 'cbor';
import jsrsasign from 'jsrsasign';
import { parseAuthenticatorData } from '@simplewebauthn/server/helpers';
import { ParsedAuthenticatorData } from '@simplewebauthn/server/dist/helpers';
// ...
// const inputKeyId = get keyId from the app - this is a base64 of the sha256sum of the public key in uncompressed point format
// const attestation = get attestation from the app
const validateAttestation = async (inputKeyId: string, challenge: string, attestation: string): Promise<boolean> => {
@Ridwy
Ridwy / MTAudioProcessingTapSample.swift
Created July 30, 2021 11:21
How to use MTAudioProcessingTap in Swift 5
//
// Created by Chiharu Nameki @Ridwy on 2021/07/30.
//
import UIKit
import AVFoundation
/*
Using MTAudioProcessingTap, you can touch raw audio samples playing with AVPlayer.
This sample code shows how to use MTAudioProcessingTap in Swift 5.
@MBing
MBing / install_wlan_dongle.sh
Last active June 26, 2025 21:32
install TP-Link-WN725N Nano USB Wifi on Raspberry Pi with Kernel 5.10+
# DO NOT PUT THE WIFI DONGLE IN THE DEVICE BEFORE MENTIONED EXPLICITLY BELOW
# Brief note, after this the UI will not show the usb dongle,
# the wifi does work and I get an IP address, so all works,
# but I don't go into detail of making it show on the Raspbian UI.
# (for this purpose I don't care about the UI)
# For the use of this I connected my device to an ethernet connection and through the Router could see the IP which I can SSH into.
## STEP 1: Prepare machine and install packages needed
@anyashka
anyashka / lunch_model.py
Last active November 3, 2024 15:19
Updatable Lunch Classifier for Core ML
# Creating a model with TuriCreate
import turicreate as tc
data = tc.image_analysis.load_images('image/train', with_path=True)
data['label'] = data['path'].apply(lambda path: 'healthy' if '/healthy' in path else 'fast food')
model = tc.image_classifier.create(data, target='label')
model.save("LunchImageClassifier.model")
model.export_coreml('LunchImageClassifier.mlmodel')
@MatthewRalston
MatthewRalston / roflcopter.md
Created February 14, 2018 19:03
ROFLcopter ASCII text art

ROFLcopter ASCII

If you hear SOI SOI SOI, you better RUN RUN RUN ’cause the ROFLCOPTER ASCII army is coming for you!

THE ORIGINAL ROFLCOPTER

 ROFL:ROFL:ROFL:ROFL
         _^___
 L __/ [] \
@ckelner
ckelner / README.md
Last active October 5, 2020 17:08
Using the Datadog Ansible integration with Ansible Tower

Datadog and Ansible Tower

This doc explains the nuances of using the Datadog Ansible Integration with Ansible Tower.

Ansible Setup

In a directory of your choosing, run the following commands:

  • vagrant init ansible/tower
  • vagrant up --provider virtualbox
  • vagrant ssh
@glebm
glebm / README.md
Last active March 29, 2023 19:56
Rails Link Preload Headers

This lets you set the preload headers for your assets, so that the browser can start fetching them before it begins parsing HTML.