Skip to content

Instantly share code, notes, and snippets.

@mrjones-plip
mrjones-plip / example.log
Last active December 11, 2024 18:14
count d_community_health_volunteer_area and count by YEAR-MONTH
/home/mrjones/.nvm/versions/node/v22.11.0/bin/node /home/mrjones/Documents/MedicMobile/app-services-team/fetch-users/index.js
Fetching CHAs for snyamira
Fetching CHAs for samburu
Fetching CHAs for baringo
Fetching CHAs for bomet
Fetching CHAs for bungoma
Fetching CHAs for busia
Fetching CHAs for elgeyomarakwet
Fetching CHAs for embu
Fetching CHAs for homabay
@mrjones-plip
mrjones-plip / create.record.sh
Last active May 29, 2024 19:42
Upload JSON document to CouchDB 10x per Y seconds
#!/bin/bash
server="192-168-68-26.local-ip.medicmobile.org:10443"
database="medic"
login="medic"
password="password"
sleep=59
createRecord(){
json='{
@mrjones-plip
mrjones-plip / delete-slack-messages.js
Last active May 1, 2024 14:46 — forked from firatkucuk/delete-slack-messages.js
Deletes last 30 days of slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@mrjones-plip
mrjones-plip / generate.stats.sh
Created October 16, 2023 18:15
generate.stats.sh
#!/bin/bash
set -u
echo "erasing results.txt"
cat /dev/null > results.txt
if [ ! -f cache/responses.3.log ]; then
echo "caching 3.x responses"
grep medicmobile.org CHT3/*log|cut -f7,8,9 -d " " |grep -v "^\-1"|cut -f3 -d " " \
@mrjones-plip
mrjones-plip / .gitignore
Last active March 10, 2023 22:03
Install CHT and test certbot LE creation
.idea
@mrjones-plip
mrjones-plip / gist:7bbe7b0a44ce7876a551b9730c6fc43d
Last active May 27, 2022 00:12
Developer CHT Install with couchdb in docker (standard)
# a quick way to install a CHT instance. Uses starndard docker based couchdb
# see bare-metal guide here: https://gist.github.com/mrjones-plip/7760b6a1a7e9cface3714a16fe60eb93
#
# assumes running as not root user, but with user with sudo
# update system, choose default and "ok" for any prompts
sudo apt update
sudo apt -y dist-upgrade
# install NVM, add to path, install node 12
@mrjones-plip
mrjones-plip / cht-install-bare-metal-couch.txt
Last active May 26, 2022 23:44
Developer Install CHT - bare metal couchdb
# a quick way to install a CHT instance. Uses bare metal couchdb
# see docker based install here: https://gist.github.com/mrjones-plip/7bbe7b0a44ce7876a551b9730c6fc43d
#
sudo apt update
sudo apt dist-upgrade
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@mrjones-plip
mrjones-plip / couch.js
Created May 16, 2022 23:53
Script for bulk adding CHT contacts with ever so slightly different attachments ;)
/*
To use this script:
- Save this script into a directory
- Include a PNG image in the directory called SamplePNG_1.png
- From within that directory, install nano: `npm install nano`
- Update the constants below to match your desired values
- Run the script: 'node couch.js`
*/
const NUMBER_OF_DOCS = 100;
const STARTING_INDEX = 2200; // Update this on subsequent runs to avoid id conflicts when running the script multiple times
@mrjones-plip
mrjones-plip / cht-docker-compose-macos-11.6-intell.md
Last active October 22, 2021 21:48
Install CHT on clean install of macOS Big Sur 11.6 MacBook Pro (Intel)

CHT Install on clean install of macOS Big Sur 11.6 on MacBook Pro (Intel MacBook Pro 15-inch, Mid 2014)

  1. download docker desktop
  2. install docker desktop
  3. install homebrew (can do xcode too, but mabye homebrew is lighter weight? Oh...homebrew installs xcode?) which will in turn install git
  4. clone cht-core into ~/Documents/:
     cd ~/Documents&&git clone https://github.com/medic/cht-core.git
    
  5. create an env file for your first CHT instance in ~/Documents/
@mrjones-plip
mrjones-plip / lookup.py
Last active June 25, 2021 03:45
whois lookup python script
import time
import whois
import whois.parser
import argparse
import logging.handlers
import sys
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address='/dev/log')