Skip to content

Instantly share code, notes, and snippets.

@altendky
altendky / kwargs.diff
Last active April 23, 2016 18:41 — forked from anonymous/-
diff --git a/canmatrix/canmatrix.py b/canmatrix/canmatrix.py
index 12b0eed..82eed9e 100644
--- a/canmatrix/canmatrix.py
+++ b/canmatrix/canmatrix.py
@@ -116,69 +116,47 @@ class Signal(object):
# def __init__(self, name, startbit, signalsize, is_little_endian, is_signed=False, factor=1, offset=0, min=0, max=0, unit="", receiver=[], multiplex=None):
def __init__(self, name, **kwargs):
- if 'startBit' in kwargs:
- self._startbit = int(kwargs["startBit"])
@altendky
altendky / aisgen.py
Last active March 20, 2019 15:38 — forked from eliotb/aisgen.py
Tools for working with Texas Instruments COFF and AIS files
#!/usr/bin/env python
'''Read fully linked TI COFF file, and generate AIS format file
Commandline parameters
enable sequential read,
pll and emifb configuration
pinmux configuration
enable checksums
'Eliot Blennerhassett' <[email protected]>
def monitor_model():
try:
user = User().save()
except:
result = 'failed'
else:
result = 'passed'
user.delete()
return django.http.Response(result)
@altendky
altendky / loop.py
Created February 2, 2017 20:36 — forked from anonymous/loop.py
for counter, addresses in enumerate(sales_addresses):
cell = 'A' + counter
sheet[cell] = addresses
height = None
while height is None:
try:
height = int(input("Enter something: "))
except (ValueError):
print("Not an integer!")
else:
if not 0 < height < 23:
print("Height's smaller than 0 or bigger than 23")
from PyQt5.QtWidgets import QHeaderView
from ui_orderconversion import Ui_OrderConversion
class OrderConversion(Ui_OrderConversion):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setupUi(self)
self.column_width()
from PyQt5.QtWidgets import QHeaderView, QTableWidgetItem
from PyQt5.QtCore import Qt
from ui_orderconversion import Ui_OrderConversion
class OrderConversion(Ui_OrderConversion):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# initialize ui
self.setupUi(self)
def is_isogram(string):
string_lower = string.lower()
for i in string_lower:
if not i.isalpha():
continue
for n in range(string_lower.index(i) - 1,
string_lower.index(i) - len(string_lower), -1):
if string_lower[n] == i:
print("\"%s\" is not an isogram.") % (string)
return False
@altendky
altendky / ok.py
Last active October 17, 2017 03:58 — forked from converge/ok.py
browser.find_element_by_xpath('//article/div[2]/section[2]/div/a').click()
try:
tmp_list = browser.find_element__by_tag_name('_6e4x5')
except NoSuchElementException:
tmp_list = browser.find_element_by_class_name('_3gwk6')
tmp_list = tmp_list.find_elements_by_tag_name('a')
@altendky
altendky / models.py
Last active December 22, 2017 17:56 — forked from RyanBreaker/models.py
class IdModel:
id = db.Column(db.Integer, primary_key=True)
class User(IdModel, UserMixin, db.Model):
username = db.Column(db.String(64), index=True, unique=True)
email = db.Column(db.String(128), index=True, unique=True)
password_hash = db.Column(db.String(128))
def __repr__(self):