Skip to content

Instantly share code, notes, and snippets.

View indilo53's full-sized avatar

Jérémie N'gadi indilo53

View GitHub Profile
@indilo53
indilo53 / gist:536f9c898f680a14791000cffecd1f45
Created October 18, 2017 21:00 — forked from vincentbernat/gist:4391597
`socat` as an SSH reverse proxy (or anything TCP-based)
local$ socat TCP-LISTEN:2222,bind=127.0.0.1,reuseaddr,fork TCP-LISTEN:2223,reuseaddr
local$ ssh -p 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no localhost
remote$ socat TCP:10.0.2.2:2223 TCP:127.0.0.1:22
@indilo53
indilo53 / table.sizeof.lua
Last active July 26, 2018 18:07
LUA - Get correct size of table even if it contains nil values
function table.sizeOf(t)
local keys = {}
for k,v in pairs(t) do
table.insert(keys, tonumber(k))
end
table.sort(keys, function(a,b) return a < b end)
@indilo53
indilo53 / gist:1d1075d8f426c05b6b77ef0dbbffda90
Created February 15, 2019 10:30 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@indilo53
indilo53 / membuf.cpp
Last active February 22, 2020 06:34 — forked from mlfarrell/membuf.cpp
C++ read/write streams from memory buffer
struct MemoryBuffer : std::streambuf
{
char* begin;
char* end;
MemoryBuffer(uint8_t* begin, uint8_t* end) :
begin((char*)begin),
end((char*)end)
{
this->setg((char*)begin, (char*)begin, (char*)end);
@indilo53
indilo53 / dlcweapondata.js
Last active November 22, 2023 02:08
alt:V MemoryBuffer usage example
function getDlcWeaponData(dlcWeaponIndex) {
const buffer = new alt.MemoryBuffer(312);
game.getDlcWeaponData(dlcWeaponIndex, buffer);
const data = [
buffer.int(0), // int emptyCheck; //use DLC1::_IS_DLC_DATA_EMPTY on this
buffer.int(8), // int weaponHash;
buffer.int(16), // int unk;
@indilo53
indilo53 / README.md
Created January 31, 2020 15:20 — forked from anhldbk/README.md
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation