Skip to content

Instantly share code, notes, and snippets.

View ajohnclark's full-sized avatar

John Clark ajohnclark

View GitHub Profile
@htcai
htcai / Fedora-27-tf-gpu.md
Last active April 13, 2021 16:06
Install NVIDIA Driver and TensorFlow-GPU on Fedora 27 (GNOME3)

Acknowledgement

This blog benefits a lot from the helpful guidance from mdda and wangruohui.

Notice

Desktop environment sensitivity

The strategy presented below applies to the default desktop environment GNOME3 of Fedora 27, but may not work for others such as KDE Plasma. For instance, KDE tends to crash after installation of NVIDIA drivers. Actually, this is also confirmed by my own recent experience with Fedora KDE Plasma.

@hreeder
hreeder / parser.py
Last active February 27, 2024 03:53
Python nginx Log Parser
#!/usr/bin/env python
import gzip
import os
import sys
import re
INPUT_DIR = "nginx-logs"
lineformat = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""", re.IGNORECASE)
@garaud
garaud / sqlalchemy-orm-query-to-dataframe.py
Last active June 7, 2024 13:55
Example to turn your SQLAlchemy Query result object to a pandas DataFrame
# -*- coding: utf-8 -*-
"""From a Query.all(), turn this result to a pandas DataFrame
Table creation and example data come from the official SQLAlchemy ORM
tutorial at http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Just take a look at the 'query_to_dict' function and the last part of the __main__.
"""