Skip to content

Instantly share code, notes, and snippets.

View JonBons's full-sized avatar

JonBons

View GitHub Profile
@JonBons
JonBons / reverse-ssh.md
Created August 25, 2021 21:54 — forked from harshilpatel312/reverse-ssh.md
Alternative to VPN: reverse-ssh + autossh

Description

You want to access a remote computer from a local computer. The remote computer does not have a public IP, is on its own local network and can access internet.

Solution: To access the remote computer, you need a middleman (proxy server) which is accessible by both, the remote and the local computer. You open an ssh tunnel from remote to middleman. Use that ssh tunnel on local to access the remote computer.

Method

  1. Create VM on a cloud service (like https://www.digitalocean.com/products/droplets/). Get its public IP and password.
  • As a test, access the VM from local computer: ssh hkpatel@203.162.43.12. If successful, proceed. If not, inspect.
@JonBons
JonBons / infowriter_scene_based_text.py
Created December 29, 2020 18:38
OBSInfoWriter - Scene based hotkey text
import json
import obspython as obs
from itertools import cycle
class InfowriterSource:
def __init__(self, source_name=None, scene_data=None):
self.source_name = source_name
self.scene_data = scene_data
def update_text(self):
@JonBons
JonBons / bootcmd.sh
Last active November 20, 2019 23:50
Yi 4K loop recording cleanup/auto-record
#!/bin/sh
cd /tmp/fuse_d/DCIM
storage_space=$(df -k . | tr -s ' ' | cut -d" " -f 5 | tail -n 1 | sed 's/[^0-9]*//g')
latest_dcim=$(ls | tail -1)
cd $latest_dcim
if [ $storage_space -gt 90 ]
then
rm "$(ls -t | tail -1)"
rm "$(ls -t | tail -1)"
@JonBons
JonBons / tpw.cpp
Created August 3, 2018 19:37
tpw animspeed mod
class CfgPatches
{
class TPW_ANIMSPEED
{
units[] = { };
weapons[] = { };
requiredAddons[] = {"A3_Anims_F"};
version = "20160612";
versionStr = "20160612";
versionDesc= "TPW ANIMS";
@JonBons
JonBons / gist:b844e62ef6da61898c47c5314fd46f7d
Created December 15, 2016 19:39
HG: List all files between revs that have changed with specified extension
hg diff --rev v9.8.4 --rev v9.8.5 --include "**/*.aspx" --stat
open System.Data
open System.Data.SqlClient
let nonQuery (connectionString) query : unit =
use conn = new SqlConnection(connectionString)
use cmd = new SqlCommand()
cmd.CommandText <- query
cmd.CommandType <- CommandType.Text
cmd.Connection <- conn
type Type =
| String of int
| Guid
| Date
| Bool
| Integer
| Enum of name : string
type Property =
{ Name : string
class CfgEnvSounds;
class EnvSounds: CfgEnvSounds
{
class Default
{
name = "N";
sound[] = {"MBG_Nam_C\ambient\Jungle_Clearing_1",0.4,1};
soundNight[] = {"MBG_Nam_C\ambient\Jungle_Night_3",0.4,1};
};
class Rain
@JonBons
JonBons / gist:45da87130887d7b112d1
Last active August 29, 2015 14:22
F3 - Ruskie Spy Babel
if (isNull player) then
{
waitUntil {sleep 0.1; !isNull player};
};
if (hasInterface) then
{
if ((vehicleVarName player) in ["ruskiespy"]) then {
waitUntil{(player getVariable ["f_var_assignGear_done", false])};
waitUntil{[] call acre_api_fnc_isInitialized};
open System
[<EntryPoint>]
let main argv =
let lines = [1..(Console.ReadLine() |> int)]
let result =
lines
|> List.map(fun _ -> Console.ReadLine().Split() |> Seq.map int |> Seq.sum |> string)
|> String.concat("\n")