Skip to content

Instantly share code, notes, and snippets.

@leasual
leasual / gist:b0e51aa0331a8325389667a065898353
Created September 2, 2022 14:47 — forked from jesusprubio/gist:4066845
Kamailio.cfg with SIP over websockets support included.NOTE: For GRUU support change (line 363): modparam("registrar", "gruu_enabled", 1)
#!KAMAILIO
#
# Kamailio (OpenSER) SIP Server v4.1 - default configuration script
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
# Direct your questions about this file to: <sr-users@lists.sip-router.org>
#
# Refer to the Core CookBook at http://www.kamailio.org/wiki/
# for an explanation of possible statements, functions and parameters.
@leasual
leasual / App-re-signing.md
Created December 10, 2021 12:28 — forked from mattio/App-re-signing.md
Re-signing an .ipa file for iOS distribution

Re-signing an .ipa file for iOS distribution

There are several apps I currently have to re-sign. They are apps built by various outside vendors who do not want to share the source code, but we want the apps published from our account and we do not want to give them our certificate or access to publish the apps on our behalf. ¯\_(ツ)_/¯ These are the steps I use to re-sign them. I've decided to keep the steps manual because, frankly, it's an error-prone process, something done infrequently, and a moving target. Some detail always seems to shift with every major Xcode release or App Store change.

These steps are current as of iOS 14 and Xcode 12. They assume you already have your Distribution Certificate installed in Keychain.


I'm going to use an example named "Matt's App.ipa". If you need to provide instructions to a vendor to deliver this file to you properly, I've included what I use below.

@leasual
leasual / camera.py
Created August 24, 2021 01:48 — forked from cbednarski/camera.py
Webcam capture for python - Pops up a preview from your webcam and snaps a picture when you press 'q'
import cv2
# Windows dependencies
# - Python 2.7.6: http://www.python.org/download/
# - OpenCV: http://opencv.org/
# - Numpy -- get numpy from here because the official builds don't support x64:
# http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
# Mac Dependencies
# - brew install python
@leasual
leasual / mz_invisible_widget.js
Created October 24, 2020 00:01 — forked from mzeryck/mz_invisible_widget.js
A Scriptable script that creates "invisible" widget backgrounds based on your iOS wallpaper, and then either uses them as a Scriptable widget background or exports to your camera roll.
// This widget was created by Max Zeryck @mzeryck
/*
You can't add commit messages to gists, so I just want to say thanks to everyone who has used, modified,
and enjoyed this script! This version adds the ability to export to the Files app thanks to Simon (@simonbs),
and Plus-sized phones thanks to /u/Alekhat-akatsuki. I hope to add support for the iPhone 12 series as soon as
I can get my hands on screenshots from the new phones. If you'd like to help, I just need to see 3 small widgets
in a diagonal pattern, like this: https://imgur.com/a/rRzLrG2 It doesn't matter which widgets, as long as they
contrast with the background.
*/
@leasual
leasual / build_android.sh
Created July 8, 2020 07:49 — forked from CaiJingLong/build_android.sh
在mac上 使用ndk r20 编译 ffmpeg 4.2.2 的so
#!/bin/bash
NDK=/Volumes/Evo512/sdk/android-ndk-r20
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
API=21
function build_android
{
echo "Compiling FFmpeg for $CPU"
./configure \
@leasual
leasual / gist:3dc13db8ecf1dd3afa4792291eaf055c
Created April 17, 2020 00:43
Get IP Address Android Device
// AndroidManifest.xml permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
// test functions
NetworkUtil.getMACAddress("wlan0");
NetworkUtil.getMACAddress("eth0");
NetworkUtil.getIPAddress(true); // IPv4
NetworkUtil.getIPAddress(false); // IPv6
@leasual
leasual / NetworkUtil
Created April 17, 2020 00:42
Get IP Address Android Device
object NetworkUtil {
/**
* Convert byte array to hex string
* @param bytes
* @return
*/
fun bytesToHex(bytes: ByteArray): String {
val sbuf = StringBuilder()
for (idx in bytes.indices) {
val intVal: Int = (bytes[idx] and 0xff.toByte()).toInt()
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
@leasual
leasual / Animation.md
Created March 10, 2020 06:09 — forked from bigmountainstudio/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

  • view hierarchy
  • layer tree
import Foundation
import Reachability
//Reachability
//declare this property where it won't go out of scope relative to your listener
fileprivate var reachability: Reachability!
protocol ReachabilityActionDelegate {
func reachabilityChanged(_ isReachable: Bool)