Skip to content

Instantly share code, notes, and snippets.

Avatar
🏢
Hybrid Work

Alice Zoë Bevan–McGregor amcgregor

🏢
Hybrid Work
View GitHub Profile
View iteration.py
def one(iterable, condition=bool):
found = False
for i in iterable:
if not condition(i): continue
if found: return False
found = True
return found
View client1.py
#!/usr/bin/python
from __future__ import print_function
# This makes Python use the newer print() syntax.
import socket
import time
import sys
import twitter
View gist:df21382a94ae8985cfc3
<?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 Sep 11, 2018 — 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.
View 35257305_better_v2.py
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
View helper-a-orig.py
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, )