Skip to content

Instantly share code, notes, and snippets.

View xarses's full-sized avatar

Andrew Woodward xarses

  • San Francisco, Bay Area, CA
View GitHub Profile
@dentechy
dentechy / WSL-ssh-server.md
Last active March 30, 2024 16:16
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on 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. 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)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
@mivade
mivade / cli.py
Last active January 18, 2024 07:51
Using a decorator to simplify subcommand creation with argparse
"""This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@pshchelo
pshchelo / mount-qcow2-lvm-image.sh
Last active March 6, 2024 19:05
List of commands to mount/unmount a qcow2 image conatining LVM partitions.
# kudos to dzaku at consolechars.wordpress.com
### MOUNT qcow2 image with lvm partitions
# ensure nbd can handle that many partitions
sudo modprobe nbd max_part=8
# present image as block device through NBD
sudo qemu-nbd --connect=/dev/nbd0 <image.qcow2>
@fnuecke
fnuecke / bios.lua
Created December 24, 2014 00:35
Primitive remote code execution via OC network
local m=component.proxy(component.list("modem")())
m.open(2412)
local function respond(...)
local args=table.pack(...)
pcall(function() m.broadcast(2412, table.unpack(args)) end)
end
local function receive()
while true do
local evt,_,_,_,_,cmd=computer.pullSignal()
if evt=="modem_message" then return load(cmd) end
@mueslo
mueslo / aggdmg.py
Last active August 29, 2015 14:06
Calculates damage probabilities
#!/usr/bin/env python2
import fractions
import itertools
import operator
import numbers
import collections
class OutcomeProb(object):
'''combines probabilistic outcomes with operator.add'''
def __init__(self, *args, **kwargs):
@dmsimard
dmsimard / gist:7304179
Created November 4, 2013 15:26
Example init.pp puppet-ceph (stackforge)
class { 'ceph::repo':
release => "dumpling"
}
class { 'ceph::init': }
Class['ceph::repo'] -> Class['ceph::init']
class PBEWithMD5AndDES(object):
"""PBES1 implementation according to RFC 2898 section 6.1"""
SALT = '\x0c\x9d\x4a\xe4\x1e\x83\x15\xfc'
COUNT = 5
def __init__(self, key):
key = self._generate_key(key, self.SALT, self.COUNT, 16)
self.key = key[:8]
self.iv = key[8:16]
@jt
jt / merge.md
Created August 23, 2011 18:47
Merge a forked gist

If someone forks a gist and you'd like to merge their changes. Do this:

  1. clone your repo, I use the name of the gist

     git clone git://gist.github.com/1163142.git gist-1163142
    
  2. add a remote for the forked gist, I'm using the name of my fellow developer

     git remote add aaron git://gist.github.com/1164196.git
    
@chetan
chetan / parse_sysbench_io.rb
Created November 23, 2010 21:31
convert sysbench i/o test output into tsv format
#!/usr/bin/env ruby
module SysBench
class IO
attr_accessor :version, :threads, :test
attr_accessor :total_size, :block_size
attr_accessor :byte_rate, :request_rate
attr_accessor :min, :max, :avg, :top