Skip to content

Instantly share code, notes, and snippets.

View dstarcev's full-sized avatar

Dmitriy Startsev dstarcev

View GitHub Profile
@GertjanBrouwer
GertjanBrouwer / splittingdata.py
Created February 15, 2018 13:24
Split data into train and valid directories
import os
import glob
import numpy as np
#goal: when I have a directory structure that looks like this:
# -data
# -cats(contains all cat images)
# -dogs(contains all dog images)
# -elephants(contains all elephant images)
#
@BretFisher
BretFisher / README.md
Last active May 1, 2023 02:28
Simple Apache + Nginx Reverse Proxy Example in Docker Compose
  1. download these two files to the same directory
  2. docker-compose up
  3. http://localhost should show you "it works" which is apache being reverse-proxied through nginx
  4. docker sets up DNS for web based on compose service name so the nginx front-end can find http://web
  5. proxy is set to listen on public port 80 on host so it'll receive incoming traffic, then push to httpd
@dimasch
dimasch / redis-clear
Last active July 5, 2024 07:16
Clear a redis cache in Docker
docker exec -it container-name redis-cli FLUSHALL
@Pavelyev
Pavelyev / syncFolders.cs
Last active December 16, 2015 15:46
.NET Sample of mirroring one folder to another using FileSystemWatcher from System.IO
//using System;
//using System.IO;
var initDir = @"H:\1";
var destDir = @"H:\2";
var watcher = new FileSystemWatcher(initDir);
Func<string, string> destPath = path => path.Replace(initDir, destDir);
watcher.Changed += (sender, eventArgs) => File.Copy(eventArgs.FullPath, destPath(eventArgs.FullPath), overwrite: true);
watcher.Deleted += (sender, eventArgs) => File.Delete(destPath(eventArgs.FullPath));
watcher.Renamed += (sender, eventArgs) =>
@halberom
halberom / opt1_template.j2
Last active April 12, 2024 11:33
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
@m0n5t3r
m0n5t3r / gist:1006281
Created June 3, 2011 12:50
set x-forwarded-ssl correctly (nginx, http+https in the same config)
set $ssl off;
if ($scheme = https) {
set $ssl on;
}
proxy_set_header X-Forwarded-Ssl $ssl;