Skip to content

Instantly share code, notes, and snippets.

@allright
allright / vxlan-mesh-create.sh
Created February 3, 2024 15:51 — forked from cloudnull/vxlan-mesh-create.sh
Create a vxlan mesh on multiple hosts for multiple bridged interfaces to create isolated user networks. The primary use-case here is tenant Isolation with OpenStack Ironic.
#!/bin/bash
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@allright
allright / gist:6ea671ae342cdde78360c656dbfeae6d
Created October 21, 2023 16:00 — forked from payam-int/gist:edf977c6af603fee0ce1b05da7792fe7
Prometheus Node Exporter - CPU and Memory Usage

CPU Usage :

(1 - avg(irate(node_cpu_seconds_total{mode="idle"}[10m])) by (instance)) * 100

Memory Usage :

100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[10m]) + avg_over_time(node_memory_Cached_bytes[10m]) + avg_over_time(node_memory_Buffers_bytes[10m])) / avg_over_time(node_memory_MemTotal_bytes[10m])))

Более удобной и актуальной версией является эта статья с использованием traefik

https://gist.github.com/dancheskus/365e9bc49a73908302af19882a86ce52


Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

@allright
allright / gist:88174496b26ac99cf4d8e17b225a305c
Created September 19, 2023 08:33 — forked from trodrigues/gist:1023167
Checkout only certain branches with git-svn
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do.
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk:
git svn clone -T trunk http://example.com/PROJECT
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T:
git svn clone -T branches/somefeature http://example.com/PROJECT
@allright
allright / AndroidManifest.xml
Created June 26, 2019 08:01 — forked from Sunno/AndroidManifest.xml
Set a custom contact item in android address book
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my_app" >
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<!-- for syncing -->
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
@allright
allright / Auto-layout-keyboard-adjustment.md
Created July 6, 2018 12:29 — forked from dlo/Auto-layout-keyboard-adjustment.md
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.