Skip to content

Instantly share code, notes, and snippets.

View offby1's full-sized avatar

Eric Hanchrow offby1

View GitHub Profile
;; This has been happening, on and off, for _years_. Some code,
;; somewhere, is turning on auto-fill-mode in ALL my buffers,including
;; the minibuffer. I've never figured out who the culprit is! THIS
;; OTTA CATCH 'EM RED-HANDED!1!
;; (debug-on-entry 'auto-fill-mode)
;;(cancel-debug-on-entry 'auto-fill-mode)
(when (default-value 'auto-fill-function)
(message "Hmm ... who gave auto-fill-function a default value?!")
(setq-default auto-fill-function nil))
>>> x = ([i/10.0 for i in range (41)])
>>> y = [i*i for i in x]
>>> y
[0.0, 0.010000000000000002, 0.04000000000000001, 0.09, 0.16000000000000003, 0.25, 0.36, 0.48999999999999994, 0.6400000000000001, 0.81, 1.0, 1.2100000000000002, 1.44, 1.6900000000000002, 1.9599999999999997, 2.25, 2.5600000000000005, 2.8899999999999997, 3.24, 3.61, 4.0, 4.41, 4.840000000000001, 5.289999999999999, 5.76, 6.25, 6.760000000000001, 7.290000000000001, 7.839999999999999, 8.41, 9.0, 9.610000000000001, 10.240000000000002, 10.889999999999999, 11.559999999999999, 12.25, 12.96, 13.690000000000001, 14.44, 15.209999999999999, 16.0]
>>>
>>> all(isinstance (x, int) for x in range (10))
True
>>> all(isinstance (x, int) for x in [1, 2, 3, 'whoops'])
False
>>>
import base64
import hashlib
inputvalue = 'hello, Sailor'
hashedURL1 = base64.b64encode(inputvalue)
md5 = hashlib.md5()
md5.update(inputvalue)
hashedURL0 = md5.hexdigest()
print(hashedURL0)
def do_one_device(this_thread):
device_info = this_thread.device
# ... whatever we need, including starting a subprocesses and waiting for it
class DeviceThread(threading.Thread):
def __init__(self, result_queue, device):
super(LoadConfigThread, self).__init__(**kwargs)
self.result_queue = result_queue
self.device = device
(defun set-approporiate-font (frame)
(when (eq window-system 'ns)
(global-set-key (kbd "M-`") 'other-frame)
(set-frame-font
(cond
((= (display-pixel-height) 1440)
;; fancy iMac at work
"Inconsolata-20")
;; I don't keep custom.el in revision control; I try hard to prevent
;; anything important from showing up in it. As I write this, the
;; only stuff in it is the list of packages that I've installed with
;; package-install; I can live with that.
(setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file t)
(find-function-setup-keys)
(global-set-key (kbd "<f5>") 'bury-buffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-x |") 'toggle-truncate-lines)
(global-set-key (kbd "M-r") 'revert-buffer)
(ido-mode 1)
(ido-everywhere 1)
(require 'dired-x)
#!/usr/bin/env python
from __future__ import print_function
import string
st = range (128)
for x in bytearray(st):
print (string.zfill (format(x, 'b'), 8))
import bigcommerce
import logging
logging.basicConfig (level=logging.DEBUG)
api = bigcommerce.api.BigcommerceApi(host='https://store-45eg5.mybigcommerce.com/api/v2/', basic_auth=('henry', '10f0f4f371f7953c4d7d7809b62463281f15c829'))
print(api.Products.all())