Skip to content

Instantly share code, notes, and snippets.

View alfonsotesauro's full-sized avatar

Alfonso Maria Tesauro alfonsotesauro

  • Independent Developer - Freelancer
  • Naples, Italy
View GitHub Profile

Various Versions of macOS/OSX will fail on install for various reasons. You can fix them by disconnecting from your wifi or network or resetting your NVRAM. Booting from your USB stick, opening terminal and doing: date ########## where the # nubers are below. Format is: MMDDhhmmYY

10.16 - 0.5 Leopard   - date 0101010121 <- Currently not needed
10.15 - Catalina      - date 0101010120 <- Currently not needed
10.14 - Mojave        - date 0101010119 <- Currently not needed
10.13 - High Sierra   - date 0101010118

10.12 - Sierra - date 0101010117

let monitor = NWPathMonitor()
/* closure called when path changes */
let pathUpdateHandler = {(path:NWPath) in
let availableInterfaces = path.availableInterfaces
if !availableInterfaces.isEmpty {
//e.g. [ipsec4, en0, pdp_ip0]
let list = availableInterfaces.map { $0.debugDescription }.joined(separator: "\n")
}
@alfonsotesauro
alfonsotesauro / fsevent.cpp
Created March 19, 2021 23:41 — forked from yangacer/fsevent.cpp
Minimum example of FSEvent (no thread creation)
#include <CoreServices/CoreServices.h>
#include <iostream>
void callback(
ConstFSEventStreamRef stream,
void *callbackInfo,
size_t numEvents,
void *evPaths,
const FSEventStreamEventFlags evFlags[],
const FSEventStreamEventId evIds[])
@alfonsotesauro
alfonsotesauro / README.md
Created December 22, 2020 02:05 — forked from Anubisss/README.md
How to compile statically linked OpenVPN client for ARMv5

How to compile statically linked OpenVPN client for ARMv5

You need to install ARMv5 gcc cross compiler: apt-get install gcc-arm-linux-gnueabi

You have to define a directory (via --prefix) where all of your binaries will be installed (copied). In the guide I use the following: /home/user/vpn_compile

OpenSSL

  1. Download the source: wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
@alfonsotesauro
alfonsotesauro / ipv6.rsc
Created December 3, 2020 21:52 — forked from mtrimarchi/ipv6.rsc
Fastweb IPv6 Mikrotik RouterOS
/interface 6to4
add clamp-tcp-mss=yes disabled=no dont-fragment=no dscp=inherit local-address=2.230.192.193 mtu=1480 name=6rd remote-address=81.208.50.214
/ipv6 pool
add name=ip6 prefix=2001:b07:2e6:c0c1:: prefix-length=64
/ipv6 address
add address=2001:b07::/32 advertise=no disabled=no eui-64=no from-pool="" interface=6rd no-dad=no
add address=::/64 advertise=yes disabled=no eui-64=no from-pool=ip6 interface=bridge no-dad=yes
Checking 'Algorithm.swift'
./Algorithm.swift:18: warning: Line 18 uses a space before a colon
./Algorithm.swift:19: warning: Line 19 uses a space before a colon
./Algorithm.swift:29: warning: Line 29 uses a space before a colon
./Algorithm.swift:30: warning: Line 30 uses a space before a colon
./Algorithm.swift:41: warning: Line 41 uses a space before a colon
./Algorithm.swift:48: warning: Line 48 uses a space before a colon
./Algorithm.swift:58: warning: Line 58 uses a space before a colon
./Algorithm.swift:76: warning: Line 76 uses a space before a colon
./Algorithm.swift:86: warning: Line 86 uses a space before a colon
//
// GlowingImageView.swift
// Glowing Circle
//
// Created by Alfonso Maria Tesauro on 10/06/2019.
// Copyright © 2019 Alfonso Maria Tesauro. All rights reserved.
//
import Cocoa
@alfonsotesauro
alfonsotesauro / FindStringDeepInDictionary.m
Created January 10, 2019 23:34
This code helps you find strings nested into hierarchies of NSDictionary and NSArray
// Usage:
// NSString *toFind = @"theString";
// NSString *result = [self findStringInDictionary:dict searchString:toFind];
-(NSString *)findStringInDictionary:(NSMutableDictionary *)dict searchString:(NSString *)searchString {
NSString __block *toReturn = nil;
[dict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[NSString class]]) {