Skip to content

Instantly share code, notes, and snippets.

@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@evgeny-boger
evgeny-boger / mqtt_example.c
Created September 7, 2015 09:04
libmosquitto MQTT example
#include <signal.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <mosquitto.h>
#define mqtt_host "localhost"
#define mqtt_port 1883
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@rdakar
rdakar / Validação de CPF e CNPJ - C#
Created August 14, 2017 21:02
Validação de CPF e CNPJ - C#
namespace CpfCnpj
{
public static class CpfCnpjUtils
{
public static bool IsValid(string cpfCnpj)
{
return (IsCpf(cpfCnpj) || IsCnpj(cpfCnpj));
}
private static bool IsCpf(string cpf)
@sabas1080
sabas1080 / ESP32_HID.ino
Last active June 29, 2024 16:54
Example of HID Keyboard BLE with ESP32
/*
Copyright (c) 2014-2020 Electronic Cats SAPI de CV. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@nicosingh
nicosingh / .env
Last active June 6, 2024 17:38
MySQL cluster using docker
MYSQL_ROOT_PASSWORD=rootpass
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Area Calculator App',
@igabice
igabice / password_textfield_example.dart
Created January 8, 2020 09:50
Flutter TextField with password input type and an icon to toggle visibility
bool _showPassword = false;
Widget _buildPasswordTextField() {
return TextField(
obscureText: !this._showPassword,
decoration: InputDecoration(
labelText: 'password',
prefixIcon: Icon(Icons.security),
suffixIcon: IconButton(
icon: Icon(