Skip to content

Instantly share code, notes, and snippets.

View updateArtcile.py
import json
import os
from os.path import exists
def loopJsonFiles():
directory = os.fsencode('data')
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename.endswith(".json"):
View Import_all_data_to_solr.php
<?php
/**
* Ingest script to import all the data in the complete directory into solr
*/
include('ingest.php');
class Import_all_data_to_solr {
@404mike
404mike / ingest.php
Last active Jul 31, 2018
ingest.php
View ingest.php
<?php
/**
* Transform the json data to solr xml
* clean the data
* ingest into solr
*/
class Ingest {
View gist:e76eb6ec52c091f7eee8b14469a6ce43
# For more options and information see
# http://www.raspberrypi.org/documentat...
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
View Newspaper publisher article count - short
+------------------------------------------------------------------+--------------------+
| Publisher | Number of articles |
+------------------------------------------------------------------+--------------------+
| Evening Express | 3343 |
| Weekly Mail | 286 |
| The Cardiff Times | 193 |
| Flintshire Observer Mining Journal... | 141 |
| South Wales Daily News | 131 |
| Rhyl Record and Advertiser | 111 |
| The Aberystwith Observer | 107 |
View Newspaper publisher article count
+------------------------------------------------------------------+--------------------+
| Publisher | Number of articles |
+------------------------------------------------------------------+--------------------+
| Evening Express | 3343 |
| Weekly Mail | 286 |
| The Cardiff Times | 193 |
| Flintshire Observer Mining Journal... | 141 |
| South Wales Daily News | 131 |
| Rhyl Record and Advertiser | 111 |
| The Aberystwith Observer | 107 |
@404mike
404mike / gist:17bf6470428cf01d9cee
Created Jun 24, 2014
Remove white space and change file name to lowercase
View gist:17bf6470428cf01d9cee
#!/bin/bash
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`
done
View README.md