Skip to content

Instantly share code, notes, and snippets.

@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active April 19, 2024 16:03
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@subfuzion
subfuzion / global-gitignore.md
Last active April 19, 2024 16:01
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@Nizzle
Nizzle / shabadge.yaml
Last active April 19, 2024 16:00
ESPhome config for SHA2017 badge (https://wiki.sha2017.org/w/Projects:Badge)
esphome:
name: shabadge
esp32:
board: esp32-pro
logger:
wifi:
ssid: !secret wifi_ssid
@morvanabonin
morvanabonin / comandos-docker
Last active April 19, 2024 16:00
Comandos do Docker
Segue a lista de comandos docker e sua utilidade:
docker attach – Acessar dentro do container e trabalhar a partir dele.
docker build – A partir de instruções de um arquivo Dockerfile eu possa criar uma imagem.
docker commit – Cria uma imagem a partir de um container.
docker cp – Copia arquivos ou diretórios do container para o host.
docker create – Cria um novo container.
docker diff – Exibe as alterações feitas no filesystem do container.
docker events – Exibe os eventos do container em tempo real.
docker exec – Executa uma instrução dentro do container que está rodando sem precisar atachar nele.
@rashid327
rashid327 / states-of-india
Last active April 19, 2024 15:59
Indian States dropdown HTML
<!-- States of India -->
<select>
<option value="AP">Andhra Pradesh</option>
<option value="AR">Arunachal Pradesh</option>
<option value="AS">Assam</option>
<option value="BR">Bihar</option>
<option value="CT">Chhattisgarh</option>
<option value="GA">Gujarat</option>
<option value="HR">Haryana</option>
@rxaviers
rxaviers / gist:7360908
Last active April 19, 2024 15:59
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@jangeador
jangeador / rules.bat
Created October 31, 2014 17:46
Firewall Rules to Allow VEEAM to backup a Hyper-V Host
REM Rules are from here: http://www.veeam.com/kb1518
REM On Hyper-V Host Server open these ports
netsh advfirewall firewall add rule name="VEEAM Backup and Replication TCP" dir=in action=allow protocol=TCP localport=135,137-139,445
netsh advfirewall firewall add rule name="VEEAM Backup and Replication UDP" dir=in action=allow protocol=UDP localport=135,137-139,445
netsh advfirewall firewall add rule name="VEEAM Installer Service" dir=in action=allow protocol=TCP localport=6160
netsh advfirewall firewall add rule name="VEEAM Backup Proxy Service" dir=in action=allow protocol=TCP localport=6162
netsh advfirewall firewall add rule name="VEEAM vPower NFS Service" dir=in action=allow protocol=TCP localport=6161
netsh advfirewall firewall add rule name="VEEAM vPower NFS Service" dir=in action=allow protocol=TCP localport=6161
netsh advfirewall firewall add rule name="VEEAM Standard NFS Ports TCP" dir=in action=allow protocol=TCP localport=111,2049-2059,1058-1068
netsh advfirewall firewall add rule name="VEEAM Stand
@jxmorris12
jxmorris12 / torch_ddp_verify.py
Last active April 19, 2024 15:54
verify parameter weights & gradients in pytorch
def verify_ddp_weights_equal(model: torch.nn.Module, atol: float = 1e-5) -> None:
if hasattr(model, "module"):
model = model.module
world_size = get_world_size()
for name, param in model.named_parameters():
gathered_param = gather(param).reshape((world_size, -1))
absolute_diffs = (gathered_param[None, 0, :] - gathered_param).abs()
rank_params_eq = (absolute_diffs < atol).all()
assert rank_params_eq, f"❌ param [{name}] not equal - got max_absolute_diff={absolute_diffs.max()}"