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 | |
// Surface all Gutenberg blocks in the WordPress REST API | |
function add_blocks_to_rest_api() { | |
$post_types = get_post_types_by_support([ 'editor' ]); | |
foreach ($post_types as $post_type) { | |
register_rest_field($post_type, 'blocks', [ | |
'get_callback' => function (array $post) { | |
return parse_blocks($post['content']['raw']); |
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 script takes a csv file exported from Google Spreadsheets | |
after getting answers from a Google Form, and displays the results | |
neatly in an Markdpown file. It also aggregates the results by one | |
column (in my case the question "Group name"), which you need to | |
specify in the group_column variable. | |
The answers.csv file (from Google Spreasheets) needs to be in the | |
same directory as this python script on run time. | |
""" |
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
""" | |
Creates a CSV file to import passwords into BitWarden from an array | |
Usage: | |
- Download this file to a folder in your computer | |
- Change the file as you wish to add more account entries | |
- "cd" into the chosen download directory with the Terminal | |
- Run "python3 generate_bitwarden_import_file.py" | |
- A file called "generated_passwords.csv" will be created in the same directory |
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
# Transform png image to jpg | |
imgs = [] | |
path = "/path/containing/png/files" | |
valid_images = [".png"] | |
for f in os.listdir(path): | |
ext = os.path.splitext(f)[1] | |
if ext.lower() not in valid_images: | |
continue | |
imgs.append({ | |
'name': f, |
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
# Download images from csv | |
with open('file.csv', 'rb') as myFile: | |
reader = csv.reader(myFile, delimiter=',') | |
for row in reader: | |
if row[5] != 'Images': | |
command = 'wget ' + row[5].split('?')[0] | |
subprocess.Popen(command.split(), stdout=subprocess.PIPE) |