Skip to content

Instantly share code, notes, and snippets.

View rudolfovich's full-sized avatar

Vladimir Shestakov rudolfovich

View GitHub Profile
#!/bin/bash
# source: https://medium.com/@_oleksii_/how-to-backup-and-restore-jenkins-complete-guide-62fc2f99b457
# Jenkins Configuraitons Directory
cd $JENKINS_HOME
git fetch
git merge --commit
# Add general configurations, job configurations, and user content
@rudolfovich
rudolfovich / ssh_tunneling.md
Created August 10, 2020 18:53 — forked from ashrithr/ssh_tunneling.md
ssh tunneling and port forwarding

###Single hop tunelling:

ssh -f -N -L 9906:127.0.0.1:3306 [email protected]

where,

  • -f puts ssh in background
  • -N makes it not execute a remote command
@rudolfovich
rudolfovich / ip.php
Created May 8, 2020 19:51
Port and protocol PHP classes draft
<?php declare(strict_types=1);
/**
* Protocol numbers by IANA (Internet Assigned Numbers Authority)
*
* Source https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
*/
abstract class Protocol {
const UNDEFINED = -1;
const TCP = 6;
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@rudolfovich
rudolfovich / function_pointer.cpp
Created September 19, 2018 13:10
(draft) Custom function pointer from dll
#include <iostream>
#include <string>
#include <type_traits>
template<typename TReturn, typename... TArgs>
class _Proc
{
protected:
typedef TReturn(*ProcType)(TArgs...);
@rudolfovich
rudolfovich / StringCopy.h
Last active September 19, 2018 10:35
Safe copy to array of char
#include <string>
#include <type_traits>
template<
class T,
size_t N,
typename = std::enable_if_t< (N > 0) >
>
void Copy(T (&lhs)[N], const std::basic_string<T> & rhs)
{
@rudolfovich
rudolfovich / startup.sh
Last active August 21, 2024 15:15
Startup cron + tmux script
#!/bin/bash
# Cron + tmux statup script
# Approach was taken from http://www.nburles.co.uk/linux/starting-a-process-in-a-tmux-session-using-cron
# Sleep for 5 seconds. If you are starting more than one tmux session
# "at the same time", then make sure they all sleep for different periods
# or you can experience problems
/bin/sleep 5
# Ensure the environment is available
@rudolfovich
rudolfovich / StdIOStreamredirect.h
Last active June 21, 2018 06:06
Redirect std::cout and std::cin to string stream
#include <iostream>
#include <sstream>
class StdIOStreamRedirect
{
std::streambuf *cinbuf_;
std::streambuf *coutbuf_;
std::istringstream in_;
std::ostringstream out_;
public:
@rudolfovich
rudolfovich / AfterWindows10Installation.ps1
Last active January 18, 2021 14:07
Remove redundancy Windows 10 applications
#
# Remove Paint3D app
#
Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage
Get-AppxPackage -AllUsers Microsoft.MSPaint | Remove-AppxPackage
# Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.jpeg\Shell\3D Edit
$Items = Get-ChildItem -path HKLM:\SOFTWARE\Classes\SystemFileAssociations\ -Recurse | Where-Object { $_.Name -match '3D Edit'}
$Items | Select-Object -ExpandProperty Name
$Items | Remove-Item -Force -Recurse
@rudolfovich
rudolfovich / csvfile.h
Last active June 13, 2024 08:39
CSV file generator
#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
class csvfile;
inline static csvfile& endrow(csvfile& file);
inline static csvfile& flush(csvfile& file);