Skip to content

Instantly share code, notes, and snippets.

| NUMBER | TAGS | DATES CREATED |
| 1334 | tag1;tag2;tag3;tag4 | 2015-04-08; 2016-03-09 |
| 3455 | tag3;tag5 | 2016-03-09; 2015-04-08 |
| 33455 | tag5;tag8;tag1 | 2011-11-22; 2013-11-06; 2013-11-06; 2015-03-10 |
| 2334 | tag0 | 2011-11-22; 2013-11-06; 2013-11-06; 2013-11-06; 2013-11-06; 2013-11-06 |
| 33748 | tag4;tag1 | 2014-09-03 |
| NUBER | TAG1 | TAG2 | TAG3 | TAG4 | TAG5 | DATE1 | DATE2 | DATE3 | DATE4 | |
| 1334 | X | X | X | X | | 2015-04-08 | 2016-03-09 | | | |
#!/usr/bin/env python3
#Alphabetical substrings problem 3 Problem Set 1 EDX 6.00.1x Introduction to Computer Science and Programming Using Python Python 3.5 August 2016
"""
Assume s is a string of lower case characters.
Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your program should print
Longest substring in alphabetical order is: beggh
import "unsafe"
func main() {
var x uint32 = 0x01020304
switch *(*byte)(unsafe.Pointer(&x)) {
case 0x01:
println("Big Endian")
case 0x04:
println("Little Endian")
}
@zgrge
zgrge / proxy.py
Last active April 6, 2018 14:54 — forked from njsmith/proxy.py
import trio
import struct
import traceback
################################################################
# This part is a helper for reading N bytes from a stream
################################################################
class UnexpectedEOFError(Exception):
pass
record = b'raymond \x32\x12\x08\x01\x08\x0c\x07\x1b\r\x03\x04'
name, serialnum, school, gradelevel, Y, m, d, H, M, S = struct.unpack('<10sHHb6b', record)
from collections import namedtuple
#Can i instantly get Datetime object from unpack below?
Student = namedtuple('Student', 'name serialnum school gradelevel Y m d H M S')
Student._make(struct.unpack('<10sHHb6b', record))
dt = datetime(Y, m, d, H, M, S)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))
@zgrge
zgrge / emvcapkhash.py
Created November 18, 2020 11:11
Generate the hash for an EMV CA public key
from hashlib import sha1
'''
example of how to calculate SHA-1 hash from EMV CA Public Key in python using VISA 0x09 CA PK
'''
rid = 'A000000003'
index = '09'
modulus = '9D912248DE0A4E39C1A7DDE3F6D2588992C1A4095AFBD1824D1BA74847F2BC4926D2EFD904B4B54954CD189A54C5D1179654F8F9B0D2AB5F0357EB642FEDA95D3912C6576945FAB897E7062CAA44A4AA06B8FE6E3DBA18AF6AE3738E30429EE9BE03427C9D64F695FA8CAB4BFE376853EA34AD1D76BFCAD15908C077FFE6DC5521ECEF5D278A96E26F57359FFAEDA19434B937F1AD999DC5C41EB11935B44C18100E857F431A4A5A6BB65114F174C2D7B59FDF237D6BB1DD0916E644D709DED56481477C75D95CDD68254615F7740EC07F330AC5D67BCD75BF23D28A140826C026DBDE971A37CD3EF9B8DF644AC385010501EFC6509D7A41'
exponent = '03'

Keybase proof

I hereby claim:

  • I am zgrge on github.
  • I am zaooza (https://keybase.io/zaooza) on keybase.
  • I have a public key ASBSZNN5ikcU9vbWM5RvsPiJDWSd_PGWoMUhk3zBFaVf9wo

To claim this, I am signing this object:

#!/usr/bin/env python3
import random
import time
from influxdb_client import InfluxDBClient, Point, WriteOptions
#from influxdb_client.client.write_api import SYNCHRONOUS
mydata = {'a':'value1', 'b':'value2', 'c':'value3'}
rand_vals = list()
client = InfluxDBClient(url="http://172.16.40.14:8086", \
token="PY7Mfq7KwnoM7pnLfvXoD4uv8mk5DZzqDRtZ-6IZFFWtkCvKqL1oUeTLDCUsQhNLmP833JvHroZRslPmhhhSWw==", \