Skip to content

Instantly share code, notes, and snippets.

View amcgregor's full-sized avatar
🏢
Examining Options

Alice Zoë Bevan–McGregor amcgregor

🏢
Examining Options
View GitHub Profile
def one(iterable, condition=bool):
found = False
for i in iterable:
if not condition(i): continue
if found: return False
found = True
return found
#!/usr/bin/python
from __future__ import print_function
# This makes Python use the newer print() syntax.
import socket
import time
import sys
import twitter
<?php
$query = "SELECT * FROM members WHERE login='$login'";
$result = mysql_query($query) or die(mysql_error());
if ( mysql_num_rows($result) < 1 ) die("Invalid user?");
$record = mysql_fetch_assoc($result);
$hash = hash('sha256', $record['salt'] . $_POST['password']);
@amcgregor
amcgregor / 35257305_better_v2.py
Last active September 11, 2018 13:22 — forked from apolkosnik/35257305_better_v2.py
Some mongoengine vs pymongo timing comparisons based on https://gist.github.com/BeardedSteve/a1484adcf7475f62028e/ and discussion at http://stackoverflow.com/questions/35257305/mongoengine-is-very-slow-on-large-documents-comapred-to-native-pymongo-usage Example using Embeded documents, with additional comparison against Marrow Mongo and PyModm.
import datetime
import itertools
import random
import sys
import timeit
from collections import defaultdict
from pymongo import version as pymongo_version
from distutils.version import StrictVersion
import mongoengine as db
from pycallgraph.output.graphviz import GraphvizOutput
class Helper:
encoding = 'utf-8'
def __init__(self, udid, it_pro):
self.udid = udid
self.itpro = it_pro
def employee_id(self):
sql = "select emplid from emplid_to_alphaname where alphaname = (%s);", (self.udid, )
@amcgregor
amcgregor / not_streamlit.py
Last active November 13, 2023 15:38 — forked from spinningcat/streamlit.py
Reference https://github.com/amcgregor/python-samples/blob/main/Metaprogramming/Alternate%20Class%20Instantiation.ipynb "the punchline" and "making it importable" sections for what `html.tag` is.
from html import tag as H
def app(environ, start_response):
start_response('200 OK', [])
page = H.html [
H.title("Transvoice App"), # I use double quotes for human text, single for machine.
H.style("…"),
H.article(data_layout='twin') [
H.header [ H.h3 [ "Main Language" ] ],
@amcgregor
amcgregor / questions.md
Last active April 5, 2024 04:25 — forked from jacktolmie/gist:7af6fb196c361ef562cf45416066711f
Answers to informational interview questions provided by “FuzzyBottom” in the #webdev Libera IRC channel.
  1. Name (made up if you want)

Alice Bevan-McGregor (yay, Welsh + Scottish!)

  1. Please describe the tasks that are performed during a normal work week.

A wide variety from project management ("ScrumBan"), devops, IT infrastructure management/maintenance, to light QA validation and web design; beyond the typical sit-down and code software development aspects. Sitting down to code is driven by the project managment; "work item" / "product backlog item" / "feature" categorization and prioritization left to a qualification specialist from QA and the "product owner", respectively. Effort estimation guiding the prioritization handled by myself and my development team.

  1. What education, training, and related experience does an applicant require to work in this field?