This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: def a(keys): | |
...: d = {} | |
...: for key in keys: | |
...: inner_d = d.setdefault(key, {}) | |
...: return d | |
...: | |
In [2]: def b(keys): | |
...: d = {} | |
...: for key in keys: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
SetBatchLines, -1 | |
Process, Priority,, High | |
Opacity := 200 ; [0, 255] or off | |
Height := 0.4 ; [0., 1.] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WordReader(Iterator): | |
def __init__(self, fp=sys.stdin): | |
self.fp = fp | |
def __next__(self): | |
word = '' | |
while True: | |
c = self.fp.read(1) | |
if c is None: | |
if word: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
LOG_FILE='/var/log/motion/motion.log' | |
WEBHOOK_URL='https://hooks.slack.com/services/...' | |
USERNAME='motion' | |
CHANNEL='camera' | |
function send_slack_message { | |
DATA="payload={\"username\": \"${USERNAME}\", \"channel\": \"${CHANNEL}\", \"text\": \"$1\"}" | |
echo "data: ${DATA}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename this distribution example file to motion.conf | |
# | |
# This config file was generated by motion 4.1.1 | |
# Documentation: /usr/share/doc/motion/motion_guide.html | |
############################################################ | |
# Daemon | |
############################################################ | |
# Start in daemon (background) mode and release terminal (default: off) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import scipy.sparse as ss | |
import numpy as np | |
def scipy_run(sess, result, X, tf_indices, tf_id_values, tf_weight_values, | |
tf_dense_shape): | |
row_nnz = np.diff(X.indptr) | |
indices = np.asarray([[row_i, col_i] | |
for row_i, nnz in enumerate(row_nnz) |