Skip to content

Instantly share code, notes, and snippets.

@dazuelos
dazuelos / pfdump.sh
Last active October 19, 2023 13:13 — forked from vitaly/pfdump.sh
script to dump PF status
#!/bin/bash
# print an anchor subset (r, n or A)
function pfprint() {
# avoid trusting PATH and .
/usr/bin/sudo pfctl -a "$2" -s"$1" 2>/dev/null
}
import SwiftUI
import PlaygroundSupport
// constants
let cardWidth: CGFloat = 343
let cardHeight: CGFloat = 212
let spacing = 36
let animation = Animation.spring()
let cardColors = [
Color(UIColor.systemRed),
@jordansinger
jordansinger / macOS.swift
Last active February 14, 2024 03:41
macOS SwiftUI Playgrounds code
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
@timothycosta
timothycosta / UIViewController+SwiftUI.swift
Last active April 28, 2023 07:00
Using UIViewController via the SwiftUI Environment
struct ViewControllerHolder {
weak var value: UIViewController?
init(_ value: UIViewController?) {
self.value = value
}
}
struct ViewControllerKey: EnvironmentKey {
static var defaultValue: ViewControllerHolder { return ViewControllerHolder(UIApplication.shared.windows.first?.rootViewController ) }
@speaktoalvin
speaktoalvin / IAPHelper.txt
Last active April 29, 2021 04:07
In App Purchase in Swift, with Receipt Validation
import UIKit
import StoreKit
//MARK: SKProductsRequestDelegate
extension IAPHelpers : SKProductsRequestDelegate
{
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
{
@WenchaoD
WenchaoD / Readme - TagFlowLayout.md
Last active May 12, 2020 03:40
Subclass UICollectionViewFlowLayout to build a tag layout, and make UICollectionView scrolling smonthly while it holds dozens of cells with round corner
We couldn’t find that file to show.
@fffaraz
fffaraz / tcp_syn.py
Created July 30, 2014 22:07
TCP syn flood in python using raw sockets
'''
Syn flood program in python using raw sockets (Linux)
http://www.binarytides.com/python-syn-flood-program-raw-sockets-linux/
Silver Moon (m00n.silv3r@gmail.com)
'''
# some imports
import socket, sys
from struct import *