If JSON data is to be shared for analysis, it's often necessary to depersonalize the data first. Depersonalization is different than anonymization. If data is anonymized, all information about the user is removed. Depersonalization, however, changes the user information to values that can't be recognized as being related to the real user. This way, it's still possible to see relationships within the data.
This file contains hidden or 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
sudo /bin/env bash |
This file contains hidden or 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
/* Begin https://example.org/path/to/wiki/MediaWiki:Common.js */ | |
/* CSS placed here will be applied to all skins */ | |
/* Simple CSS change to make page tables of contents float on the right of the page, | |
letting content wrap around it. To give a little separation from the content, | |
a wide white border is used instead of a transparent margin. The border color may | |
need to be changed to look good with other MediaWiki skins. */ | |
/* Float table of contents (TOC) to the right, so text wraps around it */ | |
/* Change thin gray border to a wide white one instead of using a transparent margin */ |
This file contains hidden or 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
/* Begin https://example.org/path/to/wiki/MediaWiki:Common.js */ | |
/* Any JavaScript here will be loaded for all users on every page load. */ | |
/* This file will be included in response to requests like https://example.org/path/to/wiki/index.php?action=raw&smaxage=0&gen=js */ | |
/* Hide the table of contents each time any page is loaded. */ | |
function hideToc() { | |
try { | |
// Detect whether the page's TOC is displayed. | |
if (document.getElementById('toc').getElementsByTagName('ul')[0].style.display != 'none') { |
Given: A users
table in MySQL containing the data from the file 1-users.tsv
.
Running the SQL query from the file 2-mysqlJsonl.sql
gives the results shown in the file 3-results.jsonl
.
This file contains hidden or 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
#!/bin/sh -- | |
# Execute with an argument containing the name of the property to be | |
# used for sorting. | |
# Improved according to a suggestion from @pkoppstein in response to my | |
# support issue: | |
# https://github.com/stedolan/jq/issues/1447#issuecomment-314918635 | |
jq --slurp --compact-output 'sort_by(.'${1}')[]' |
This file contains hidden or 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 byKeyAsc: | |
to_entries | |
| sort_by(.key) | |
| from_entries; | |
def byKeyDesc: | |
to_entries | |
| sort_by(.key) | |
| reverse | |
| from_entries; |
This file contains hidden or 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
#!/bin/bash -- | |
firstonly="/tmp/firstonly.${$}" | |
touch "${firstonly}" | |
while read line; do | |
egrep -q "^${line}\$" "${firstonly}" | |
if [[ ${?} -eq 1 ]]; then | |
# Original spacing isn't guaranteed, unfortunately. |