Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
scp $1 user@server:~
#!/usr/bin/env bash
scp user@server:$1 .
#!/usr/bin/env bash
keytool -printcert -jarfile $1

Connect OpenVPN through ssh tunnel

Create your vpn server with ssh access. I use pq.hosting

https://pq.hosting/

In /etc/openvpn/server.conf make TCP protocol

proto tcp

Restart OpenVPN service

$ systemctl restart openvpn@server.service

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
/// <summary>
/// + MovePanel
/// + Out circle image
@alexmelyon
alexmelyon / EndToPlace.cs
Last active February 23, 2023 08:07
Unity: Press End to place object onto the surface
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
#if UNITY_EDITOR
/// <summary>
/// https://gist.github.com/alexmelyon/8f79bd08c79202d1570f26faefe47bf3
/// </summary>
[ExecuteInEditMode]
@alexmelyon
alexmelyon / MouseFinger.cs
Last active November 3, 2021 06:13
Send mouse/finger unity events
using UnityEngine;
using UnityEngine.Events;
public class MouseFingerEvent
{
public Vector2 position;
public int index;
}
public class MouseFinger : MonoBehaviour
@alexmelyon
alexmelyon / CameraEditorMovement.cs
Created November 2, 2021 20:44
Unity camera movement like Editor
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraEditorMovement : MonoBehaviour
{
[Header("Mouse")]
public float lookSpeedH = 2f;
public float lookSpeedV = 2f;
public float zoomSpeed = 2f;
@alexmelyon
alexmelyon / LcmArray.kt
Created August 7, 2019 11:46
Lcm for array in Kotlin
fun main() {
val list = listOf(24, 36, 145, 48, 72L)
list.reduce { total, next -> lcm(total, next) }.let { println(it) }
}
/**
* НОК Наименьшее общее кратное
*/
fun lcm(a: Long, b: Long): Long {
/**
* Если слова анаграммы, то у них одинаковое количество всех букв
* (то есть в обоих словах 2 буквы а, одна буква р, нет буквы к, и тд).
* Во втором слове можно запомнить индексы соответствующих букв,
* и найти эти же конкретные буквы в первом слове.
* Например слова АААААББДКРР АБРАКАДАБРА, тогда массив из чисел,
* который показывает на каком месте буква из первого слова
* расположена во втором, будет выглядеть так:
* 0,3,5,7,10,1,9,6,4,2,8.
* Если непонятно зачем это нужно, то сейчас поясню