Skip to content

Instantly share code, notes, and snippets.

View poppingtonic's full-sized avatar
💭
I may be slow to respond.

Brian Muhia poppingtonic

💭
I may be slow to respond.
View GitHub Profile
@poppingtonic
poppingtonic / gist:197124f557c2872c0abac43453790c78
Created October 7, 2022 11:44
rsync multiple files from a server in parallel, reading from a filelist
cat dllist | parallel -j 8 rsync -aHvxz --relative user@host.domain:/path/to/files/./{} .
SNO Organisation unit/Data Adolescents (10-14 years) presenting with pregnancy Adolescents (15-19 years) presenting with pregnancy Total
1 Nairobi County 2028 9706 11734
2 Kakamega County 217 6469 6686
3 Homa Bay County 451 5481 5932
4 Nakuru County 456 5427 5883
5 Kajiado County 824 5010 5834
6 Narok County 310 5275 5585
7 Bungoma County 151 5426 5577
8 Meru County 209 5047 5256
9 West Pokot County 290 4722 5012
@poppingtonic
poppingtonic / pbs.py
Created November 28, 2019 16:44
COCOHub Gist
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of PyBOSSA.
#
# PyBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
https://maps.googleapis.com/maps/api/staticmap?key=YOUR_API_KEY&center=47.65,-122.35000000000002&zoom=12&format=png&maptype=roadmap&style=element:geometry%7Ccolor:0xf5f5f5&style=element:labels.icon%7Cvisibility:off&style=element:labels.text.fill%7Ccolor:0x616161&style=element:labels.text.stroke%7Ccolor:0xf5f5f5&style=feature:administrative.land_parcel%7Celement:labels%7Cvisibility:off&style=feature:administrative.land_parcel%7Celement:labels.text.fill%7Ccolor:0xbdbdbd&style=feature:poi%7Celement:geometry%7Ccolor:0xeeeeee&style=feature:poi%7Celement:labels.text%7Cvisibility:off&style=feature:poi%7Celement:labels.text.fill%7Ccolor:0x757575&style=feature:poi.park%7Celement:geometry%7Ccolor:0xe5e5e5&style=feature:poi.park%7Celement:labels.text.fill%7Ccolor:0x9e9e9e&style=feature:road%7Celement:geometry%7Ccolor:0xffffff&style=feature:road.arterial%7Celement:labels.text.fill%7Ccolor:0x757575&style=feature:road.highway%7Celement:geometry%7Ccolor:0xdadada&style=feature:road.highway%7Celement:labels.text.fill%7Ccolor:
@poppingtonic
poppingtonic / bot_web_server.py
Created November 21, 2018 13:18
bot web server
# import the necessary packages
import ast
import logging
from PIL import Image
import numpy as np
import settings
import helpers
from classes import disease_classes
from quart import Quart, request, jsonify
import redis
@poppingtonic
poppingtonic / gist:e4ebe6e68d4ba8ae7e76ac8a4a9d629d
Created October 26, 2018 00:54
PyConKE 2018 Convnet Talk
https://docs.google.com/presentation/d/1nApyvRZSAdvomrgaWNRuP90UVAlp6OufnU7Vpo0a1Ck/edit?usp=sharing
import pandas as pd
from fastai.text import *
import html
LANG='fr'
def preprocess_wiki_lm(path):
DATA = Path(path)
trn_df = pd.read_csv(DATA/'train.csv', header=None)
val_df = pd.read_csv(DATA/'valid.csv', header=None)
@poppingtonic
poppingtonic / extract.sh
Last active November 2, 2018 22:57
convert a PDF to TIFF using gs, convert from TIFF to txt using tesseract
# $1 is the first argument
# remove result.txt
#rm output/result.txt
fname=`echo "$1" | awk -F "/" '{print $(NF)}'`
# convert the pdf to a group of tiffs
if [ ! -e extracted_tz_parliament/$fname.txt ];
then
Mar 22 09:13:30 metabox systemd-udevd[342]: seq 2902 queued, 'change' 'power_supply'
Mar 22 09:13:30 metabox systemd-udevd[342]: seq 2902 forked new worker [4117]
Mar 22 09:13:30 metabox systemd-udevd[4117]: seq 2902 running
Mar 22 09:13:30 metabox systemd-udevd[4117]: RUN '/usr/local/bin/aclidswitch AC' /usr/lib/udev/rules.d/98-aclidswitch.rules:5
Mar 22 09:13:30 metabox systemd-udevd[4117]: RUN 'lmt-udev auto' /usr/lib/udev/rules.d/99-laptop-mode.rules:1
Mar 22 09:13:30 metabox [4118]: starting '/usr/local/bin/aclidswitch AC'
Mar 22 09:13:30 metabox systemd-udevd[4117]: '/usr/local/bin/aclidswitch AC'(err) '/usr/bin/xbacklight: -set requires an argument'
Mar 22 09:13:30 metabox systemd-udevd[4117]: '/usr/local/bin/aclidswitch AC'(err) 'usage: /usr/bin/xbacklight [options]'
Mar 22 09:13:30 metabox systemd-udevd[4117]: '/usr/local/bin/aclidswitch AC'(err) ' where options are:'
Mar 22 09:13:30 metabox systemd-udevd[4117]: '/usr/local/bin/aclidswitch AC'(err) ' -display <display> or -d <display>'
from fastai.imports import *
from fastai.transforms import *
from fastai.conv_learner import *
from fastai.model import *
from fastai.dataset import *
from fastai.sgdr import *
from fastai.plots import *
sz=224 # image size
# architecture, from https://github.com/facebookresearch/ResNeXt