Skip to content

Instantly share code, notes, and snippets.

@KrystianGraba
KrystianGraba / gist.md
Created November 29, 2022 23:36 — forked from Tristan-Ballin/gist.md
Regex for an email

Matching an Email: A Tutorial

A regex, which is short for regular expression, is a sequence of characters that defines a specific search pattern. When included in code or search algorithms, regular expressions can be used to find certain patterns of characters within a string, or to find and replace a character or sequence of characters within a string. They are also frequently used to validate input.

Summary

I will be teaching you how to make a regex for an email validation and describing which parts of the regex describe what.

/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
@KrystianGraba
KrystianGraba / wireguard.conf
Created November 29, 2022 23:35 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
for (int i = 0 ; i< lenght_size;i++){
for (int j=0;j< obiekt_array_list.size();j++){
if (obiekt_array_list.get(j).get_number(i) == Integer.parseInt(String.valueOf(gamma.charAt(i))))
if (obiekt_array_list.size()>2)
//code
}
}
#!/bin/bash
for zmienna in {1..100}
do
zmienna="$((zmienna+3))"
if [ $(echo "$zmienna % 3" | bc) -eq 0 ]
then
#echo "podzielna: $zmienna"
case $zmienna in
[0-9]) #echo "1: $zmienna"
skladak="000$zmienna.jpg"
#!/bin/bash
echo "program Projekt;" >> b.txt >> c.txt
echo "begin" >> b.txt >> c.txt
wyr1="^echo *" #echo
wyr2="read *" #read
#deklaracje_zmiennych
wyr3="^[a-zA-Z0-9]*\=[0-9]" #deklaracja_integer
wyr4="^[a-zA-Z0-9]*\=\"" #deklaracja_string
#include <iostream>
#include <math.h>
class Trojkat{
private:
float x, y, z;//boki trojkata
float obw2;//polowa obwodu trojkata
float pole;//obwod trojkata
public:
Trojkat();
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
for (int i = 1;i <= 10;i++) {
cout << i;
Sleep(1000);
#include <iostream>
using namespace std;
int main()
{
int ile;
cout << "Do ktorej liczby wyswietlic liczby parzyste: " << endl;
cin >> ile;
cout << "Liczby parzyste do liczby " << ile << endl;
for (int i = 2; i <= ile;i++) {
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main()
{
cout << "Losowanie liczb: " << endl;
//losowanie
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main()
{
int ile_liczb;
cout << "Ile liczb z przedziału 1-100 wylosowac: ";
cin >> ile_liczb;