Programmers seem to struggle with regex. In this post, I will show you how easy regex can be and some usefull examples for regex.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* For more information, please refer to <https://unlicense.org> | |
*/ | |
#ifndef __ANSI_COLOR_CODES_H_ | |
#define __ANSI_COLOR_CODES_H_ | |
//Regular text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __RE_REPLACE__ | |
#define __RE_REPLACE__ | |
#include <string.h> | |
#include <regex.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib import quote | |
class SSLRedirect(object): | |
def __init__(self,app): | |
self.app=app | |
def __call__(self,environ,start_response): | |
proto = environ.get('HTTP_X_FORWARDED_PROTO') or environ.get('wsgi.url_scheme', 'http') | |
if proto=='https': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inf(i=0, step=1): | |
#un generador de iteradores infinitos, como el xrange, pero infinito | |
while True: | |
yield i | |
i+=step | |
for i in inf(): | |
print i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <regex.h> | |
#define TEST_REGEX "^.*\\/([a-zA-Z_.]*)\\.log : [A-Z]{3} [0-9]{2}\\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{6} .* : (.*)$" | |
#define MAX_REGEX_MATCHES 5 | |
#define MAX_STRING_SIZE 1000 | |
#define MAX_ERR_LENGTH 50 | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$(basename $0)" = "install-odoo.sh" ]; then | |
echo "don't run install-odoo.sh, because it's not fully automated script. Copy, paste and execute commands from this file manually" | |
exit 0 | |
fi | |
#### Detect type of system manager | |
export SYSTEM='' | |
pidof systemd && export SYSTEM='systemd' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// As seen on http://www.di.uniba.it/~reti/LabProRete/Interazione(TCP)Client-Server_Portabile.pdf | |
#if defined WIN32 | |
#include <winsock.h> | |
#else | |
#define closesocket close | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <unistd.h> | |
#endif | |
#include <stdio.h> |
sudo pacman -Syu zsh
You do not need to install manjaro-zsh-config
and all the other related packages like zsh-syntax-highlighting
, zsh-history-substring-search
, zsh-autosuggestions
, etc., as we will use Oh My Zsh.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SCHEMA=public | |
DB=certwatch | |
HOST=crt.sh | |
PORT=5432 | |
USER='guest --no-password' | |
DIR=$(pwd) | |
mkdir -p $DIR |
OlderNewer