Skip to content

Instantly share code, notes, and snippets.

View arioch's full-sized avatar

Tom De Vylder arioch

View GitHub Profile
@arioch
arioch / xtrabackup_full_increment_restore.sh
Created May 25, 2023 08:19 — forked from SQLadmin/xtrabackup_full_increment_restore.sh
Automate xtrabackup for FULL/Incremental and restore
#!/bin/bash
# This is my production backup script.
# https://sqlgossip.com
set -e
set -u
usage() {
echo "usage: $(basename $0) [option]"
echo "option=full: Perform Full Backup"
@arioch
arioch / git-extract-file.markdown
Created March 20, 2023 14:32 — forked from ssp/git-extract-file.markdown
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@arioch
arioch / nginx.conf
Created December 13, 2022 14:36 — forked from regadas/nginx.conf
nginx cached forward proxy #example
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
@arioch
arioch / setup_ovirtmgmt.sh
Created January 20, 2022 08:42 — forked from phoracek/setup_ovirtmgmt.sh
setup ovirtmgmt network with static ip via vdsm-client
echo '{"bondings": {}, "networks": {"ovirtmgmt": {"nic": "eth0", "netmask": "255.255.255.0", "ipaddr": "1.1.1.2", "gateway": "1.1.1.1", "defaultRoute": true}}, "options": {"connectivityCheck": false}}' | vdsm-client -f - Host setupNetworks
vdsm-client Host setSafeNetworkConfig
@arioch
arioch / cors.inc
Created April 23, 2020 13:10 — forked from antonbabenko/cors.inc
(nginx AND varnish) + CORS (working example)
more_set_headers "Access-Control-Allow-Origin: $http_origin";
more_set_headers "Access-Control-Allow-Credentials: true";
# OPTIONS indicates a CORS pre-flight request
if ($request_method = 'OPTIONS') {
more_set_headers "Access-Control-Max-Age: 1728000";
more_set_headers "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS";
more_set_headers "Access-Control-Allow-Headers: Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since";
more_set_headers "Content-Length: 0";
@arioch
arioch / LocationChanger.plist
Created May 29, 2018 09:46 — forked from wbills/LocationChanger.plist
Execute script in OSX when WiFi connects
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>locationchanger</string>
<key>ProgramArguments</key>
<array>
@arioch
arioch / create-iso.sh
Created October 10, 2017 09:36 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@arioch
arioch / highsierra_bootable.sh
Created October 10, 2017 09:36 — forked from agentsim/highsierra_bootable.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@arioch
arioch / gist:f7dd700255c1bc21fe129fe0aec14420
Created November 28, 2016 13:32 — forked from carlspring/gist:6762356
TeamCity REST API Commands