Skip to content

Instantly share code, notes, and snippets.

@mikhailnov
mikhailnov / assocheck.sh
Created Aug 18, 2020
Crazy assocheck.sh from WPS Office 11.x
View assocheck.sh
#!/bin/bash
unset XDG_DATA_HOME
templatedir="/opt/kingsoft/wps-office/office6/asso_template"
if [ ! -d $templatedir ]; then
echo "asso_template not found"
exit 1
fi
mimelist=(".pptx" ".ppt" ".pptm" ".pps" ".pot" ".potm" ".potx" ".ppsx" ".dps" ".dpsx" ".dpt" ".dptx" ".dpss" ".dpso" ".xlsx" ".xls" ".xlsm" ".xlt" ".xltm" ".xltx" ".et" ".etx" ".ett" ".ettx" ".ets" ".eto" ".docx" ".docm" ".doc" ".dot" ".dotm" ".dotx" ".wps" ".wpsx" ".wpss" ".wpso" ".wpt" ".wptx" ".rtf")
View prov-req.sh
#!/usr/bin/env bash
LIST="${LIST:-30 31 32}"
_gen(){
set -e
trap 'echo ERROR $line' ERR
line="$1"
fc="$2"
suffix="$(echo "$line" | tr '.' '\n' | grep ^fc | tail -n1)"
View amon.c
/*
*
* Info: amon.so
* Contact: mailto: <luca [at] lucaercoli.it> https://www.lucaercoli.it
* Version: 1.1
* Author: Luca Ercoli
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@mikhailnov
mikhailnov / st.c
Last active Feb 13, 2020
Get default selinux user context
View st.c
// gcc -lselinux st.c -o st.bin
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <selinux/selinux.h>
#include <selinux/get_context_list.h>
int main(){
security_context_t *contextlist = NULL;
int rc = -1;
View kinstall.sh
#!/bin/sh
set -efu
export DEBIAN_FRONTEND=noninteractive
FALLBACK=0
APT_MAIN=0
DONE=0
khpkg=""
kernel="$(uname -r || :)"
if [ -z "$kernel" ]; then
echo "Unable to get kernel version, trying fallback"
View merge.sh
#!/bin/bash
set -xefu
# New packages
for i in \
createrepo_c \
dnf \
dnf-plugins-core \
dnf-plugins-extras \
View gist:b5edfbca508548dd119affdee688cdac
231:
KillUserProcesses
When using systemd's default tmp.mount unit for /tmp, the mount point will now be established with the "nosuid" and "nodev" options. This avoids privilege escalation attacks that put traps and exploits into /tmp.
* A new rpm macro %systemd_ordering is provided by the macros.systemd file. It can be used in lieu of %systemd_requires in packages which don't use any systemd functionality and are intended to be installed in minimal containers without systemd present. This macro provides ordering dependencies to ensure that if the package is installed in the same rpm transaction as systemd, systemd will be installed before the scriptlets for the package are executed, allowing unit presets to be handled. New macros %_systemdgeneratordir and %_systemdusergeneratordir have been added to simplify packaging of generators.
* The os-release file gained VERSION_CODENAME field for the distribution nickname (e.g. VERSION_CODENAME=woody).
@mikhailnov
mikhailnov / build-rpm.sh
Created Oct 5, 2019
Подкладывание пакетов в репозиторий со своего билдера, /mdv/build-rpm.sh
View build-rpm.sh
OUTPUT_FOLDER=$HOME/output
container_data() {
# Generate data for container
[ "$rerun_tests" = 'true' ] && return 0
c_data=container_data.json
project_name=systemd
echo '[' > ${c_data}
@mikhailnov
mikhailnov / tr1.sh
Created Jul 28, 2019
Трансляция вконтакте м захватом видео с iOS RTMP Streamer и звука из подключенного к компу микрофона
View tr1.sh
# https://video.stackexchange.com/a/26258
# https://superuser.com/a/538038
# https://trac.ffmpeg.org/wiki/SupportedMediaTypesInFormats
# itoffset works only for video! https://trac.ffmpeg.org/ticket/1349
# To test: ffplay -listen 1 -i rtmp://0.0.0.0:8082/dumacast
ffmpeg \
-listen 1 -itsoffset 00:00:05.060 -i rtmp://0.0.0.0:8082/dumacast \
-f pulse -i default \
-f flv -strict -1 -preset veryfast -c:v libx264 -c:a aac "${RTMP_VK_URL}/${RTMP_VK_KEY}"
View dz2_v4.cpp
#include <iostream>
#include <string.h>
#include <cmath>
using namespace std;
/* эти переменные будем использовать в разных функциях, поэтому
* сделаем их глобальными, вынеся за пределы функции */
string input_string;
string converted_string;
string converted_string_copy_demo;
You can’t perform that action at this time.