Skip to content

Instantly share code, notes, and snippets.

View bityob's full-sized avatar

Yonatan Bitton bityob

View GitHub Profile
@bityob
bityob / WSL-ssh-server.md
Last active July 18, 2024 15:41 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server when launching Windows Subsystem for Linux

How to automatically start ssh server when launching Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Uninstall and reinstall the ssh server using the following commands:
    1. sudo apt remove openssh-server
    2. sudo apt install openssh-server
  2. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
  3. Change UsePrivilegeSeparation to no
@bityob
bityob / DictWithMaxKeys.cs
Last active December 25, 2017 20:25
Dictionary with maximun length, keep last N keys on dictionary, using Queue object (C#)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace DictMaxLength
{
@bityob
bityob / DictWithMaxKeys.py
Created December 25, 2017 19:09
Dictionary with maximun length, keep last N keys on dictionary, using deque object
from collections import deque
class DictWithMaxKeys:
def __init__(self, maxlen, init=None):
self.maxlen = maxlen
self._deque = deque()
self._dict = {}
if init is not None:
self._dict.update(init)
@bityob
bityob / http_request_using_telnetlib.py
Created July 28, 2017 16:10
HTTP Request using telnetlib (Python 3)
from telnetlib import Telnet
with Telnet('www.example.com', '80') as tn:
req = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n".encode("ascii")
tn.write(req)
while True:
row = tn.read_until('\n'.encode('ascii'))
print(row)
L.AnimatedMarker = L.Marker.extend({
options: {
// meters
distance: 200,
// ms
interval: 1000,
// animate on add?
autoStart: true,
// callback onend
onEnd: function(){},
@bityob
bityob / find_union_algo.py
Last active July 19, 2017 15:22
find_union_algo created by bityob - https://repl.it/J8x7/7
indata = """1 2
3 4
5 6
7 8
7 9
2 8
0 6
1 9"""
data = [x.split() for x in indata.splitlines()]
@bityob
bityob / nuget_getter.py
Created July 19, 2017 05:19
Download nuget packages with all dependencies recursively
# -*- coding: utf-8 -*-
import scrapy
import os
urls = {}
class NugetSpider(scrapy.Spider):
global urls
name = 'nuget'
allowed_domains = ['nuget.org']
@bityob
bityob / Run_Local_Oracle_Db_Instance.md
Last active January 13, 2020 18:32
How to run a local oracle db instance, fast and quick? (using docker)
  • Install docker for your OS

  • Download image

$ docker pull blakeberg/oracledb
  • Run image
$ docker run -d -h orxe11g --name=orxe11g -p 49132:22 -p 49133:1521  blakeberg/oracledb:1.0
@bityob
bityob / pocket_move_all_list_to_archive.py
Created July 6, 2017 22:52
Move all list to archive (Pocket)
# https://pypi.python.org/pypi/pocket-api/
from pocket import Pocket, PocketException
from sys import exit
# see link above, how to set key and token
key = ""
token = ""
p = Pocket(key, token)
print("Connected")
@bityob
bityob / Links.md
Last active May 24, 2017 18:07
Tile Servers Links