Skip to content

Instantly share code, notes, and snippets.

@skvl
skvl / asciihist.py
Created March 28, 2022 16:09 — forked from bgbg/asciihist.py
ASCII histograms
from __future__ import print_function
import numpy as np
def asciihist(it, bins=10, minmax=None, str_tag='',
scale_output=30, generate_only=False, print_function=print):
"""Create an ASCII histogram from an interable of numbers.
Author: Boris Gorelik [email protected]. based on http://econpy.googlecode.com/svn/trunk/pytrix/pytrix.py
License: MIT
"""
ret = []
@skvl
skvl / xen_4.14.0+88-g1d1d1f5391-2_amd64.build
Created December 29, 2020 12:42
Debian Xen 4.14 source package build fail
This file has been truncated, but you can view the full file.
dpkg-buildpackage -us -uc -ui -b
dpkg-buildpackage: info: source package xen
dpkg-buildpackage: info: source version 4.14.0+88-g1d1d1f5391-2
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Hans van Kranenburg <[email protected]>
dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
debian/rules clean
dh clean --with=python3 --buildsystem=pybuild
debian/rules override_dh_auto_clean
@skvl
skvl / To check
Created October 15, 2020 15:39
tmp
To check
@skvl
skvl / xen-windbg.md
Last active April 29, 2020 11:01
Setup Xen VM with Windows 10 as WinDbg network target

NIC PCI passthrough

  • Определить адрес сетевой карточки командой (для примера адрес будет 00:19.0):
lspci
xl pci-assignable-add 00:19.0
@skvl
skvl / xen-networking.md
Last active March 3, 2020 09:25
Configure Xen networking

Создание xenbr0 в системе с netplan

Исходная задача состояла в том, что бы восстановить ВМ из снимка. При этом доступность интернета не имела значения.

Основывается на ответе.

  • В файл /etc/netplan/50-cloud-init.yaml добавить строки вида (из примера):
network:                                                                                                      
    ethernets:                                                                                                
@skvl
skvl / paramiko_run_app_win10.py
Last active July 17, 2019 10:26
Install and Configure OpenSSH Server on Windows 10
#!/usr/bin/env python3
import click
from datetime import datetime, timedelta
from getpass import getpass
import paramiko
from pathlib import Path, PurePath, PureWindowsPath
from tempfile import NamedTemporaryFile
from uuid import uuid4
@skvl
skvl / share-folder.ps1
Last active June 27, 2019 07:41
PowerShell script to share folder
function Share-CrashDumps {
"From https://devblogs.microsoft.com/scripting/how-to-use-powershell-to-create-shared-folders-in-windows-7/"
$crashDumpsDir = "C:\CrashDumps"
$shareDir = "CrashDumps"
IF (!(TEST-PATH $crashDumpsDir)) {
NEW-ITEM $crashDumpsDir -type Directory
}
$Shares=[WMICLASS]"WIN32_Share"
@skvl
skvl / push_to_github.rb
Created June 27, 2019 06:27 — forked from harlantwood/push_to_github.rb
Commit and push via Github REST API, from ruby RestClient
# Committing changes to a repo via the Github API is not entirely trivial.
# The five-step process is outlined here:
# http://developer.github.com/v3/git/
#
# Matt Swanson wrote a blog post translating the above steps into actual API calls:
# http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html
#
# I was not able to find sample code for actually doing this in Ruby,
# either via the HTTP API or any of the gems that wrap the API.
# So in the hopes it will help others, here is a simple function to
@skvl
skvl / pywinrm-example.py
Last active June 26, 2019 06:40
Get files from remote Windows machine with pywinrm
import base64
import getpass
import ntpath
import os
import tempfile
import time
import winrm
def is_directory_exist(session, dir_path):
@skvl
skvl / .tmux.conf
Created April 12, 2019 05:05
My configuration file for the tmux terminal multiplexer.
#------------------------------------------------------------------------------
# File: $HOME/.tmux.conf
# Author: Petr Zemek <[email protected]>
# GitHub: https://github.com/s3rvac/dotfiles/blob/master/tmux/
#------------------------------------------------------------------------------
# Rebind the prefix from C-b to C-Space.
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix