Skip to content

Instantly share code, notes, and snippets.

View populov's full-sized avatar

Serge Populov populov

View GitHub Profile
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: foo
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($http_origin ~* "^https?://((?:www\.exactmatch\.com)|(?:.*\.regexmatch\.com))$") {
set $cors "true";
@populov
populov / jing.sh
Last active November 22, 2024 11:29
Flameshot + upload screenshot to SFTP
#!/bin/bash
# Prerequisites:
# * flameshost (Take screenshot + basic edit): https://flameshot.org
# * scp (OpenSSH/SFTP file copy client) https://www.mankier.com/1/scp
# * notify-send (Desktop notifications) https://ss64.com/bash/notify-send.html
# * xclip (copy to clipboard) https://opensource.com/article/19/7/xclip
#
## Install prerequisites (Ubuntu):
# sudo apt-get install flameshot openssh-client notify-send xclip
@populov
populov / starship.toml
Last active October 28, 2022 04:17
Config for https://starship.rs - save as ~/.config/starship.toml
# Replace the "❯" symbol in the prompt with "➜"
[character] # The name of the module we are configuring is "character"
# success_symbol = "[➜](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green"
error_symbol = "[✗](bold red) "
# Disable the package module, hiding it from the prompt completely
[package]
disabled = true
[aws]
@populov
populov / import-database.sh
Last active December 5, 2018 14:28
Import local development DB
#!/usr/bin/env bash
DATABASE=dbname
CHECK_TABLE=Users
SQL_DUMP_FILE='dump_2018-01-01.sql'
BUCKET='https://s3-us-west-2.amazonaws.com/mybucket'
# Check if table exists
if [[ $(mysql -h'db' -u'user' -p'secret' -e "SHOW TABLES LIKE '${CHECK_TABLE}'" ${DATABASE}) ]]
then
echo "Database already imported"
@populov
populov / what.sh
Last active August 22, 2018 19:14
Fortune + Cowsay with random cows
#!/bin/bash
# First install fortune and cowsay:
# see http://manpages.ubuntu.com/manpages/bionic/en/man6/cowsay.6.html
# and http://manpages.ubuntu.com/manpages/bionic/man6/fortune.6.html
# $ sudo apt-get install fortune cowsay
# and some collection of fortunes. You can find available packages:
# $ apt search fortunes
# for example:
# $ sudo apt-get install fortunes fortunes-off fortunes-ru
@populov
populov / portainer.yaml
Created August 14, 2018 15:57
Docker containers management UI
version: '3'
services:
portainer:
image: portainer/portainer
container_name: portainer
network_mode: host
restart: always
ports:
- 9000:9000
@populov
populov / dnsmasq-tlds.sh
Last active July 27, 2017 20:46
Docker consul DNS
#!/bin/bash
# run with sudo!
echo "server=/service.docker/127.0.0.1#8600" > /etc/NetworkManager/dnsmasq.d/consul-tld
echo "address=/.lo/127.0.0.1" > /etc/NetworkManager/dnsmasq.d/lo-tld
service network-manager restart
@populov
populov / MySQL explode.sql
Last active September 24, 2015 10:54
Analog of explode for MySQL
DROP PROCEDURE IF EXISTS explode;
CREATE PROCEDURE explode (commaDelimitedString varchar(1000))
BEGIN
DECLARE rest, v varchar(1000);
DECLARE comaLocation INT(11);
SET rest = commaDelimitedString;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpExplode (`val` varchar(250));
SET comaLocation = LOCATE(',', rest);
/*SELECT rest AS restFirst, comaLocation AS comaFirst;*/
@populov
populov / set_password.sql
Created July 1, 2014 13:50
Set SQL Server sa password
USE master
GO
ALTER LOGIN [sa] WITH PASSWORD=N'1234567'
GO
<table width="200" align="center" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td rowspan="3"><a href="https://play.google.com/store/apps/details?id=com.haunted.office.buzz" target="_blank"><img alt="Офисный будильник" src="http://serge.populov.com/_/rsrc/1370146452912/projects/ic_office.buzz.png" /></a></td>
<td><span style="color:#0eb26c;font-weight:bold">Office Buzz</span></td>
</tr>
<tr>
<td><span>Info: </span>
<a href="http://en.haunted-soft.com/apps/office-buzz" target="_blank">EN</a>
<a href="http://ru.haunted-soft.com/apps/office-buzz" target="_blank">RU</a></td>