Skip to content

Instantly share code, notes, and snippets.

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

Nicholas Bob NicholasTurner23

💭
I may be slow to respond.
  • kampala, Uganda
View GitHub Profile
@NicholasTurner23
NicholasTurner23 / checkbox
Last active March 13, 2018 16:48
This gets you horizontal checkboxes in ugandaemr
<obs id="no-fp-method" conceptId="dc7620b3-30ab-102d-86b0-7a5022ba4115"
answerConceptId="
aaf150a5-92d2-416f-8254-95d34ed9c4ab"
answerLabel="No Family Planning Method Given"
style="checkbox" class="horizontal-layout-options"/>
@NicholasTurner23
NicholasTurner23 / gist:03ff2053ffd4704f714361a2ccf9ffac
Last active January 14, 2019 12:42
Download email attachments from a specific email address in your inbox
from datetime import datetime
class Server(models.Model):
owner = models.CharField(max_length=100)
user_name = models.CharField(max_length=100)
password = models.CharField(max_length=100)
host = models.CharField(max_length=100)
status = models.BooleanField(default=True)
created_on = models.DateTimeField(auto_now=True)
if(isset($_FILES['files']) && !empty($_FILES['files'])){
$fileName = $_FILES['files']['name'];
$fileTemp = $_FILES['files']['tmp_name'];
$fileType = $_FILES['files']['type'];
$allowedext = array('image/png', 'image/gif', 'image/jpeg', 'image/jpg');
$destination = "img/";
$width = 400;
$height = 350;
@NicholasTurner23
NicholasTurner23 / bulk-insert.py
Created September 7, 2020 07:51 — forked from ellisvalentiner/bulk-insert.py
Recipe for (fast) bulk insert from python Pandas DataFrame to Postgres database
#!/usr/bin/env/python
import psycopg2
import os
from io import StringIO
import pandas as pd
# Get a database connection
dsn = os.environ.get('DB_DSN') # Use ENV vars: keep it secret, keep it safe
conn = psycopg2.connect(dsn)
from datetime import timedelta
# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
# Operators; we need this to operate!
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
@NicholasTurner23
NicholasTurner23 / routing.js
Created August 22, 2022 18:37
UseLocation to route
function CategoryPage() {
let location = useLocation();
return (
<div>
<h2>Categories</h2>
<ul>
<li><Link to={`${location.pathname}/drama`}>Drama</Link></li>
<li><Link to={`${location.pathname}/comedy`}>Comedy</Link></li>
</ul>