Skip to content

Instantly share code, notes, and snippets.

View hossinasaadi's full-sized avatar
🌍
Home

Hossin Asaadi hossinasaadi

🌍
Home
  • Amsterdam
View GitHub Profile
@hossinasaadi
hossinasaadi / MacOS-Multi-Version-Go-With-Homebrew.md
Created December 18, 2023 08:51 — forked from BigOokie/MacOS-Multi-Version-Go-With-Homebrew.md
Manage multiple versins of Go on MacOS with Homebrew

This process would likely apply to other Homebrew formula also.

First search for your desired package:

brew search go

You should get a list of results that include the below. Not "go" is very unspecific so you may get a lot of results:

@hossinasaadi
hossinasaadi / test.c
Created September 14, 2023 12:19 — forked from avesus/test.c
iOS Multipath BSD Sockets Test. Comments welcomed!
# include <sys/types.h>
# include <sys/socket.h>
# include <ifaddrs.h>
# include <arpa/inet.h>
# include <netinet/in.h>
// Bad dirty quick functions written by hot fingers:
char* ipToStr(sockaddr* addr) {
static char ip[32];
@hossinasaadi
hossinasaadi / Packet.swift
Created July 20, 2023 18:12 — forked from Taher-17/Packet.swift
PacketTunnel Provider
//
// PacketTunnelProvider.swift
// Shadowsocks
//
// Created by Taher Ismail on 19/03/19.
// Copyright © 2019 Taher Ismail. All rights reserved.
//
import NetworkExtension
import NEKit
Platform CPU GOOS GARCH GOARM SDK CGO_FLAGS CARCH
Windows x86_64 windows amd64 x86_64
Windows x86_32 windows 386 x86_32
MacOS x86_64 darwin amd64 macos x86_64
MacOS M1 darwin arm64 macos arm64
Linux x86_64 linux amd64 x86_64
Linux x86_32 linux 386 x86_32
Linux arm64 linux arm64 arm64
iOS Simulator x86_64 darwin amd64 iphonesimulator -fembed-bitcode x86_64
iOS arm darwin arm64 iphoneos -fembed-bitcode arm64
@hossinasaadi
hossinasaadi / SignInView.swift
Created July 13, 2022 10:54 — forked from jbnunn/SignInView.swift
SwiftUI + PhoneNumberKit implementation
import SwiftUI
import UIKit
import PhoneNumberKit
struct PhoneNumberTextFieldView: UIViewRepresentable {
@Binding var phoneNumber: String
private let textField = PhoneNumberTextField()
func makeUIView(context: Context) -> PhoneNumberTextField {
textField.withExamplePlaceholder = true
@hossinasaadi
hossinasaadi / README.md
Created January 19, 2022 14:09 — forked from Lazza/README.md
VPNGate Python script

vpngate.py

This script allows to use the free VPN service provided by VPNGate in an easy way. The user just needs to provide the desidered output country, and the script automatically chooses the best server.

After this step, OpenVPN is launched with the proper configuration. The VPN can be terminated by pressing Ctrl+C.

Usage

Run the script by providing the desired output country:

@hossinasaadi
hossinasaadi / echo-enqueued-styles-scripts-wordpress.php
Created January 9, 2022 17:05 — forked from omurphy27/echo-enqueued-styles-scripts-wordpress.php
Wordpress - Print Out All Enqueued Scripts And Styles On A Page
<?php
// add the below to your functions file
// then visit the page that you want to see
// the enqueued scripts and stylesheets for
function se_inspect_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
@hossinasaadi
hossinasaadi / FileObserver on Android
Created July 29, 2021 18:07 — forked from shirou/FileObserver on Android
Detect file change using FileObserver on Android
private class PathFileObserver extends FileObserver{
static final String TAG="FILEOBSERVER";
/**
* should be end with File.separator
*/
String rootPath;
static final int mask = (FileObserver.CREATE |
FileObserver.DELETE |
FileObserver.DELETE_SELF |
FileObserver.MODIFY |
@hossinasaadi
hossinasaadi / mac-setup-redis.md
Created May 3, 2021 21:19 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );