Skip to content

Instantly share code, notes, and snippets.

View 66Ton99's full-sized avatar
🇺🇦

Ton Sharp 66Ton99

🇺🇦
View GitHub Profile
@66Ton99
66Ton99 / DataBundle.php
Last active August 29, 2015 14:02
DataBundle with Enums
<?php
namespace MyNamespace;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Doctrine\DBAL\Types\Type;
class DataBundle extends Bundle
{
/**
@66Ton99
66Ton99 / Enum.php
Last active August 29, 2015 14:10
OOP enum realisation
<?php
use InvalidArgumentException;
use ReflectionClass;
/**
* Base Enum class
* Require PHP >= 5.3
*
* @author Ton Sharp <[email protected]>
@66Ton99
66Ton99 / logging_to_str.py
Created August 28, 2015 16:26
Capturing Python Log Output In A Variable
import logging
from StringIO import StringIO as StringBuffer
logger = logging.getLogger('basic_logger')
logger.setLevel(logging.DEBUG)
### Setup the console handler with a StringIO object
log_capture_string = StringBuffer()
# log_capture_string.encoding = 'cp1251'
ch = logging.StreamHandler(log_capture_string)
@66Ton99
66Ton99 / virt-manager-osx-macports
Last active October 6, 2016 10:24 — forked from LuisPalacios/virt-manager-osx
Install virt-manager OSX with MacPorts
sudo port -v install intltool py27-pygtk py27-gobject3 libvirt gtk3 libvirt
cd $HOME
# Sources:
# compile what you need from here https://github.com/jeffreywildman/homebrew-virt-manager
cd $HOME
git clone https://github.com/virt-manager/virt-manager
# Change destination install directory instead of /usr, due to
@66Ton99
66Ton99 / licenses.sh
Last active June 21, 2022 23:30
Allow to export license files from RPMs
#!/usr/bin/env bash
# RPM license exporter
# Copyright 2022 [email protected]
extract_file() {
# echo "$1"
# echo "$2"
rpm2cpio "$1" | cpio -iv --to-stdout ".$2" 1> license.tmp 2> /dev/null
ENCODING=$(uchardet license.tmp)
# echo "$ENCODING"
@66Ton99
66Ton99 / void-wsl.sh
Last active April 3, 2024 16:31 — forked from JucaRei/void-wsl.sh
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://learn.microsoft.com/en-us/windows/wsl/install
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# No need for Windows 11, but for Windows 10 install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi