Skip to content

Instantly share code, notes, and snippets.

View skobkin's full-sized avatar
💭
Let's delete this code.

Alexey Skobkin skobkin

💭
Let's delete this code.
View GitHub Profile
@skobkin
skobkin / README.md
Last active August 27, 2024 16:47
ReflectionExtractor somewhat unexpected type detection behavior

Using Symfony Serializer with Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor will cause the type of $url property to be detected incorrectly.

$serializer->deserialize(SomeResponse::class, '{"url": "http://test"}');

We'll get an exception with an error like this:

@skobkin
skobkin / add-routes.sh
Last active January 16, 2024 18:09
add-routes.sh
#!/bin/bash
# This script adds routes to listed resources via pre-defined gateway or alternatively takes gateway address
# from first argument.
# Usage:
# ./add-routes.sh
# or to override gateway:
# ./add-routes.sh 234.234.234.234
GATEWAY=${1:-"123.123.123.123"}
@skobkin
skobkin / vk_post_mass_delete.js
Last active February 13, 2023 17:16
Removing all visible posts from VK.com profile
// 1. Scroll down your profile page as much as you can
// 2. Selecting "Delete" links (for English localization). It will not work on Russian language unless you change this: link.textContent === 'Delete post'
let links = [...document.querySelectorAll('a.ui_actions_menu_item')].filter(link => link.textContent === 'Delete post');
// 3. Removing last N posts if you want to keep them. One comma for each of RECENT posts to be left undeleted.
let [,,,,,,,,,,,,, ...removeLinks] = links;
// 4. Extracting wall.deletePost() calls
let codes = removeLinks.map(element => element.getAttribute('onclick'));
@skobkin
skobkin / 00-focusrite-scarlett-18i20gen3-remap.pa
Last active June 21, 2023 15:35
PipeWire and PulseAudio channel remapping for Focusrite 18i20 gen3
# <other parts of the configuration removed>
# Remapping Focusrite IO for separate use
# Inputs
# https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-remap-source
load-module module-remap-source source_name=18i20-in-1 source_properties="device.description='18i20 Input 1'" master=alsa_input.usb-Focusrite_Scarlett_18i20_USB_P92XEEZ9A04D41-00.multichannel-input remix=no channels=1 master_channel_map=front-left channel_map=mono
load-module module-remap-source source_name=18i20-in-2 source_properties="device.description='18i20 Input 2'" master=alsa_input.usb-Focusrite_Scarlett_18i20_USB_P92XEEZ9A04D41-00.multichannel-input remix=no channels=1 master_channel_map=front-right channel_map=mono
load-module module-remap-source source_name=18i20-in-3 source_properties="device.description='18i20 Input 3'" master=alsa_input.usb-Focusrite_Scarlett_18i20_USB_P92XEEZ9A04D41-00.multichannel-input remix=no channels=1 master_channel_map=rear-left channel_map=mono
load-module module-remap-sourc
@skobkin
skobkin / keybase.md
Created August 18, 2018 20:06
keybase.md

Keybase proof

I hereby claim:

  • I am skobkin on github.
  • I am skobkin (https://keybase.io/skobkin) on keybase.
  • I have a public key ASAe_vE262mMK8fjC2Lb5hFnoMGuM5Z8srkog9jkxH57JQo

To claim this, I am signing this object:

@skobkin
skobkin / codeship_build_libsodium.sh
Created June 26, 2018 16:19
CodeShip CI libsodium build
#!/bin/bash
# Install libsodium on Codeship - https://libsodium.org
#
LIBSODIUM_DIR=${LIBSODIUM_DIR:=$HOME/cache/libsodium}
set -e
if [ ! -d "${LIBSODIUM_DIR}" ]; then
mkdir -p "${HOME}/libsodium"
wget "https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz"
@skobkin
skobkin / build.log.gz
Created February 11, 2018 23:27
/var/tmp/portage/media-video/ffmpeg-3.4.1/temp/build.log.gz
* Package: media-video/ffmpeg-3.4.1
* Repository: gentoo
* Maintainer: [email protected]
* USE: X abi_x86_32 abi_x86_64 amd64 bzip2 cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cpu_flags_x86_mmx cpu_flags_x86_mmxext cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_ssse3 elibc_glibc encode fdk fftools_aviocat fftools_cws2fws fftools_ffescape fftools_ffeval fftools_ffhash fftools_fourcc2pixfmt fftools_graph2dot fftools_ismindex fftools_pktdumper fftools_qt-faststart fftools_sidxindex fftools_trasher fontconfig gme gnutls gpl hardcoded-tables iconv kernel_linux libass lzma mp3 network openal opengl openssl opus postproc pulseaudio sdl svg theora threads truetype userland_GNU v4l vaapi vdpau vorbis vpx wavpack webp x264 x265 xcb xvid zlib
* FEATURES: distcc distcc-pump preserve-libs sandbox userpriv usersandbox
* Applying chromium.patch ...
[ ok ]
* abi_x86_32.x86: running multilib-minimal_abi_src_
@skobkin
skobkin / linux-4.1X-k10temp_ryzen.patch
Created November 26, 2017 04:24
Linux Ryzen Threadripper thermal sensor support
diff --git a/drivers/hwmon/k10temp.c b/usr/src/linux/drivers/hwmon/k10temp.c
index ce3b91f..ba97498 100644
--- a/drivers/hwmon/k10temp.c
+++ b/usr/src/linux/drivers/hwmon/k10temp.c
@@ -25,6 +25,10 @@
#include <linux/pci.h>
#include <asm/processor.h>
+#ifndef PCI_DEVICE_ID_AMD_17H_DF_F3
+#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463
@skobkin
skobkin / CachedHash.php
Last active October 20, 2017 15:27
Small hash caching benchmark
<?php
class LazyCachedHash
{
private $data = [];
private $dataHash = null;
public function __construct($data = array())
{
$this->data = $data;
@skobkin
skobkin / codeship_app_setup.sh
Last active December 13, 2017 08:43
Deploying Symfony2 application using CodeShip and Deployer
#################################
### Building environment and app
#################################
# https://documentation.codeship.com/classic/languages-frameworks/php/
phpenv local 7.1
# Passing Symfony parameters through environment variables
export SYMFONY_ENV=test
export SYMFONY__TEST_DATABASE_USER=$PGUSER
export SYMFONY__TEST_DATABASE_PASSWORD=$PGPASSWORD
export SYMFONY__TEST_DATABASE_NAME=test