Skip to content

Instantly share code, notes, and snippets.

View hightemp's full-sized avatar
🎯
Focusing

Anton Panov hightemp

🎯
Focusing
View GitHub Profile
@hightemp
hightemp / Vagrantfile
Created June 26, 2021 09:31 — forked from markuskont/Vagrantfile
Set up basic cuda/tensorflow/gpuR env with vagrant-libvirt and vfio pci-passthrough
# -*- mode: ruby -*-
# vi: set ft=ruby :
LIBVIRT_POOL = 'fast'
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1604"
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
#config.vm.synced_folder "../../datastore/spindle/ML/datasets/", "/mnt", type: "nfs", nfs_udp: false
config.vm.network "private_network", :dev => "br0", :mode => 'bridge', :ip => "192.168.17.25"

RegEx

Online Regex Tester Suites & Code Generators

  • regex101 Online regex tester for PHP, PCRE, JavaScript and Python that highlights pattern and matches on the fly. Also features a code generator and a regex debugger!
  • myregextester Sports a separate regex split tester and allows to optimize patterns (I guess this is based on Perl's Regexp::Optimizer module).
  • regexr Online regex tester with good regex replace and explain functionality.
  • debuggex Shows neat expression diagrams (not active anymore).
  • regexper translates regular expressions into an SVG image (for documentation or embedding)
  • RexV2 Evaluator for PHP PCRE, PHP Posix!, Perl, Python, Javascript, Node.JS!
@hightemp
hightemp / objects_arrays.md
Created April 9, 2021 07:07 — forked from nikic/objects_arrays.md
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@hightemp
hightemp / rutracker-magnet.user.js
Created March 7, 2021 21:20 — forked from lemenkov/rutracker-magnet.user.js
Rutracker Magnet + trackers addon for GreaseMonkey
// ==UserScript==
// @name Rutracker.org Magnet URLs
// @namespace rutrackerorg-magnet-urls
// @description Transforms torrent hash into a magnet url
// @include https://rutracker.org/*
// @include https://rutracker.cr/*
// @include https://rutracker.net/*
// @include https://rutracker.nl/*
// @include http://rutrackerripnext.onion/*
// @version 9
@hightemp
hightemp / service.js
Created February 26, 2021 07:31 — forked from paulsturgess/service.js
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}
@hightemp
hightemp / ARCH_INSTALL.MD
Created January 31, 2021 10:43 — forked from heppu/ARCH_INSTALL.MD
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
@hightemp
hightemp / arch_linux_installation.md
Created January 31, 2021 10:43 — forked from OdinsPlasmaRifle/arch_linux_installation.md
LVM on LUKS Arch installation with systemd-boot
@hightemp
hightemp / add_dir_to_PATH.sh
Created December 1, 2020 08:00
Добавление пути из аргумента в файл ~/.pathrc, который подключается в ~/.bashrc
#!/bin/bash
if [[ "$1" == "" ]]; then
file_name=$(basename $0)
echo "Add dir to PATH global var"
echo " $file_name dir"
exit 1
fi
PATHRC_file_path="$HOME/.pathrc"
export function fnGenerateColor(sText, bDarkMode=false) {
var iL = sText.length;
var iSum = 0;
for (var iI=0; iI<iL; iI++) {
iSum += iI*iI*sText.charCodeAt(iI);
}
var iH = iSum % 365;
var iS = 100;