You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
Danil Skachkov
xVir
Graduated at the faculty of Witchcraft and Wizardry in AltSTU, work as a magician at Radiant Logic.
Scripts for enabling and disabling VPN in Control Plane
This script will be usefull if you want to enable VPN automatically on coming to work and to disable it on escaping from work using great Control Plane app.
It is assumed that you use Tunnelblick to manage VPN connections.
To connect to VPN:
setqto"<your_connection_name>"tellapplication"Tunnelblick"setconfigstogetnameof configurations
if q is in configs then
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
While working on our API.AI Unity SDK I faced with task to make HTTP requests in the background thread. In the Unity there is c# Thread class, which runs particular code in background. But you can't interact with your game objects from background thread. So, I need some tool to execute code from our background thread in the Unity Main Thread. Another platforms solve this problem with different mechanisms, like Dispatcher. But in Unity there is no similar class for this. Quick search give me some tricks allowing to execute code in the main thread, and I describe the simpliest one here.
The main idea of the method is to create Queue of actions, and execute these actions in the Update method of MonoBehaviour class.
First, suppose that we have some MonoBehaviour class.
Этот скрипт для Automator позволяет добавить в Finder кнопку "Скопировать текущий путь". Если в Finder выбран файл или папка, то будет скопирован путь к соответствующему объекту. Если ничего не выбрано, то будет скопирован путь к текущей папке.
tellapplication"Finder"setseltothe selection astextif sel =""thensetseltothe insertion location astext
While working on Unity plugin project I need to map JSON to the C# objects.
For this task I used modification of the fastJSON library.
But fastJSON use codegeneration for creating special methods for reading/writing object properties.
It looks like:
Another problem I faced with while development of Unity plugin is Exception while HTTP request from the iOS platform. It produces such stacktrace:
ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<Mono.Security.Protocol.Tls.HttpsClientStream, bool> (System.Reflection.MonoProperty/Getter`2<Mono.Security.Protocol.Tls.HttpsClientStream, bool>,object)' while running with --aot-only.
at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
at System.Net.WebConnection.Write (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.String& err_msg) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.WriteHeaders () [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error) [0x000
First I thought, that this situation is caused by external dll's, linked to the ApiAiSDK.Unity.dll library. Googling did not lead to anything useful...
So I tried to check my external libraries, and run mono-xcompiler manually. mono-xcompiler compiles .NET Assembly to the native iOS code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters