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 | |
# | |
# Diff wrapper piping with diff-so-fancy | |
# | |
# Prerequiste: install diff-so-fancy | |
# https://github.com/so-fancy/diff-so-fancy | |
# | |
# Setup: | |
# - save this script somewhere | |
# - `chmod +x` the file |
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
import ipaddress | |
import requests | |
def verify_googlebot_ips( | |
list_of_ips, | |
google_ips_list_url="https://developers.google.com/static/search/apis/ipranges/googlebot.json", | |
): | |
"""Checks if each IP address in given list is in Google's official list of IP ranges. | |
Args: | |
- list_of_ips: list of ipv4 or ipv6 to check, |
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
import argparse | |
from validator_collection import validators, errors # pip install validator-collection | |
import requests # pip install requests | |
import time | |
def main(args): | |
with open(args.input) as f: | |
urls = f.readlines() | |
sitemap_urls = [] |
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
import requests | |
from requests_html import requests_html | |
if __name__ == '__main__': | |
# Define test data | |
test_data = [ | |
{ | |
"url": "https://www.example.com/", | |
"status": 200, | |
"title": "Example Domain", |
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
# Number of rows to keep | |
k = 8 | |
# Keep k first rows + transpose df | |
temp = df.head(k).T | |
# If df has more than k rows, sum remaining rows | |
if len(df) > k: | |
temp['Other rows'] = df.tail(len(df)-k).sum() |
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
############################################################################ | |
# Uses oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh/ | |
# Uses spaceship: https://github.com/denysdovhan/spaceship-prompt | |
# Uses zsh-autosuggestions: https://github.com/zsh-users/zsh-autosuggestions | |
############################################################################ | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. |
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
import networkx as nx | |
Gnx = nx.path_graph(4) # Create a random NX graph | |
nx.write_graphml(G,'graph.graphml') # Export NX graph to file | |
import igraph as ig | |
Gix = ig.read('graph.graphml',format="graphml") # Create new IG graph from file |
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
<?php | |
if ( ! function_exists('dfr_recent_articles') ) { | |
function dfr_recent_articles() { | |
if(!(is_home() || is_front_page())) { | |
echo '<section id="dfr_widget" class="widget widget_recent_entries">'; | |
echo '<h2 class="widget-title">Articles Récents</h2>'; | |
echo '<ul>'; | |
$lastposts = get_posts(); |
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
<?php | |
if ( ! function_exists('dfr_recent_articles') ) { | |
function dfr_recent_articles() { | |
if(!(is_home() || is_front_page())) { | |
echo '<section id="dfr_widget" class="widget widget_recent_entries">'; | |
echo '<h2 class="widget-title">Articles Récents</h2>'; | |
echo '<ul>'; | |
$lastposts = get_posts(); |
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
CustomLog ${APACHE_LOG_DIR}/custom-access.log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D \"%{If-Modified-Since}i\"" |
NewerOlder