Skip to content

Instantly share code, notes, and snippets.

glebov21 / web.config
Last active Sep 9, 2021
Allow to download all files from iis folder (applicationHost.config -> allowSubDirConfig="false")
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<location path="ForDownload" allowOverride="false" inheritInChildApplications="false">
<!-- Allow all users access to the Public folder -->
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="*" roles="" />
View SendMail.cs
using System;
using System.Text;
using System.Net.Mail;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Net.Mime;
using System.Diagnostics;
glebov21 / App.config
Last active Sep 2, 2021
trace listeners
View App.config
var logSW = new StreamWriter("output.txt", false);
logSW.AutoFlush = true;
Trace.Listeners.Add(new TextWriterTraceListener(logSW));
Trace.Listeners.Add(new ConsoleTraceListener(true));
<trace autoflush="true" indentsize="4">
View gist:a8a110dc759e83e66966ee48dbcdedcd
using System;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Calibration {
public static class Server {
public delegate void ProgressDelegate(int percents, long bytesReceived, long totalBytesToReceive);
glebov21 / AppSettings.cs
Last active May 17, 2021
AppSettings read write
View AppSettings.cs
public static string GetSettings(string key)
return ConfigurationManager.AppSettings[key] ?? "";
public static void SetSetting(string key, string value)
Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
configuration.AppSettings.Settings[key].Value = value;
glebov21 / WebClient.cs
Last active May 14, 2021
WebClient with progress
View WebClient.cs
namespace AutogrammaLauncher
using System;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
public static class Server
glebov21 / pgx.go
Created Aug 22, 2019
pgx postgresql connection example
View pgx.go
package main
import (
func main() {
View UnityExtensions.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public static class UnityExtensions
glebov21 / restore.bash
Created Aug 19, 2019
restore postgresql backup
View restore.bash
cd /data/pgbackup
gunzip -c ${backupfile} > restore.sql
systemctl stop aero
service postgresql restart
su postgres -c 'dropdb aerodb'
su postgres -c $'psql -f /data/pgbackup/restore.sql postgres'
systemctl restart aero
rm restore.sql
View sshd_config
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the