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.
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
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")
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
/*
================================================================================
DESCRIPTION:
Activates DAC zones and sends all units within to attack a certain location.
AUTHOR:
Nife
PARAMETERS:
@JonBons
JonBons / csvdump.sqf
Last active August 29, 2015 14:17 — forked from Wolfenswan/csvdump.sqf
///////// XML & CSV EXPORT
///////// Usage: [name,CfgPatches name]
///////// Usage: [name] to export bis stuff
///////// Usage: Paste everything below in the debug console and run it
_CfgPatches = false;
_configPath = "";
_collectionName = "test";
if(count [] > 1) then
{
$nextTagID = 0;
Function getTag() {
$global:nextTagID += 1;
return 'foo' + $global:nextTagID
}
Function makeRandom($length){
$text = '';
for($i=1; $i -le $length; $i++){
$text += [char](get-random -Minimum 65 -Maximum 90);
"foo" | Set-Content helloworld.txt
hg add helloworld.txt
hg commit -m "added helloworld"
(Measure-Command { hg log -G -l 5 }).TotalSeconds