Skip to content

Instantly share code, notes, and snippets.

@hellais
hellais / gist:4552537
Last active March 9, 2024 13:34
Clear the logs of the all the files you downloaded in OSX (ref: www.tuaw.com/2012/02/14/mac-os-xs-quarantineevents-keeps-a-log-of-all-your-downloads/)
# To delete all the currently stored files
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent where LSQuarantineEventIdentifier like "%%";'
# To never store such information you can sym link it to dev null
ln -s /dev/null ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
@hellais
hellais / color-picker-output.txt
Last active October 20, 2023 10:33
Dark or Light color picker based on luminace
gray0 (#f8f9fa): #000000
gray1 (#f1f3f5): #000000
gray2 (#e9ecef): #000000
gray3 (#dee2e6): #000000
gray4 (#ced4da): #000000
gray5 (#adb5bd): #000000
gray6 (#868e96): #000000
gray7 (#495057): #ffffff
gray8 (#343a40): #ffffff
gray9 (#212529): #ffffff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:osmand="https://osmand.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<wpt lat="53.03101" lon="13.30311">
<name>Shower Wonderland</name>
<extensions>
<osmand:icon>shop_books</osmand:icon>
<osmand:background>circle</osmand:background>
<osmand:color>#ff3f51b5</osmand:color>
<osmand:amenity_name>Shower Wonderland</osmand:amenity_name>
<osmand:amenity_type>showers</osmand:amenity_type>
@hellais
hellais / benchmark-parsers.py
Created January 18, 2016 18:55
Benchmarking of YAML vs JSON parsing
#!/usr/bin/env python
#
# Running of the script against the following files (OONI reports):
# 87M 2015-12-22.json
# 97M 2015-12-22.yaml
#
# vanilla json: 1.37932395935
# ultra json: 0.421966075897
# simple json: 1.23581790924
# yaml: 193.864903927
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 13 columns, instead of 6. in line 3.
input,probe_cc,probe_asn,test_name,measurement_start_time,anomaly,scores,confirmed,msm_failure,domain,category_code,blocking_type,explorer_url
https://shweyaunglan.com/,MM,58952,web_connectivity,2020-11-02 14:15:40,True,"{'blocking_general': 1.0, 'blocking_global': 0.0, 'blocking_country': 0.0, 'blocking_isp': 0.0, 'blocking_local': 0.0, 'analysis': {'blocking_type': 'dns'}}",False,False,shweyaunglan.com,NEWS,confirmed,https://explorer.ooni.org/measurement/20201102T141443Z_webconnectivity_MM_58952_n1_rewMBa8ca9CdF1vH?input=https%3A%2F%2Fshweyaunglan.com%2F
https://mc.warnaing.website/,MM,58952,web_connectivity,2020-11-03 03:46:31,False,"{'blocking_general': 0.0, 'blocking_global': 0.0, 'blocking_country': 0.0, 'blocking_isp': 0.0, 'blocking_local': 0.0}",False,False,mc.warnaing.website,NEWS,ok,https://explorer.ooni.org/measurement/20201103T034555Z_webconnectivity_MM_58952_n1_VnkIRYzvUxWqiCMU?input=https%3A%2F%2Fmc.warnaing.website%2F
https://coronavirus.app/,MM,132167,web_connectivity,2020-11-26 20:26:26,Fals
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import io
import yaml
import json
from datetime import datetime, timedelta
import pandas as pd
import psycopg2
import boto3