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
# Code review of McKenna/Alex https://gist.github.com/awhit012/13ccc026089c2c48d50c by kootenpv | |
# This makes it easy to create a reddit bot that | |
# A. Grabs comments from subreddits of your choice | |
# B. Searches for a keyword | |
# C. Replies to comments with that keyword from a list of responses on a CSV file | |
# This bot attempt to reply with a relevant response by searching for the words in the comment in the responses. | |
# I plan to improve upon this feature |
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
(defun toggle-trans () | |
(interactive) | |
(let* ((pair (or (frame-parameter nil 'alpha) '(100 100))) | |
(alpha (apply '+ pair))) | |
(set-frame-parameter nil 'alpha | |
(if (or (null alpha) (eq alpha 200) (eq alpha 2.0)) | |
'(85 60) '(100 100))))) |
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
// @title itmap(bytes32 => address) | |
// @author Pascal van Kooten <[email protected]> | |
// credits to: | |
// broken origin: https://github.com/ethereum/dapp-bin/blob/master/library/iterable_mapping.sol | |
// Nick "Arachnid" Johnson's new version: https://gist.github.com/Arachnid/59159497f124fdbff14bc2ca960b77ba | |
library itmap { | |
struct entry { | |
// Equal to the index of the key of this item in keys, plus 1. | |
uint keyIndex; |
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 re | |
def fn(): | |
scanner = re.Scanner([ | |
(r'([0-9]{2}):([0-9]{2}):([0-9]{2})', lambda y, x: x), | |
(r'.', lambda y, x: x) | |
]) | |
return scanner.scan("10:10:10") | |
# This works on Python 2.7, but not on Python 3.5 |
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
def move_to_dir(old, new): | |
"""Converts using e.g. old position (1,1) and new position (2, 1) to a direction (RIGHT)""" | |
if old[0] < new[0]: | |
return "RIGHT" | |
if old[1] < new[1]: | |
return "DOWN" | |
if old[0] > new[0]: | |
return "LEFT" | |
return "UP" |
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
def move_to_dir(old, new): | |
if old[0] < new[0]: | |
return "RIGHT" | |
if old[1] < new[1]: | |
return "DOWN" | |
if old[0] > new[0]: | |
return "LEFT" | |
return "UP" | |
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 sys | |
import time | |
def err(*args): | |
sys.stderr.write(', '.join([str(arg) for arg in args]) + "\n") | |
def move_to_dir(old, new): | |
if old[0] < new[0]: |
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
# -*- coding: utf-8 -*- | |
import warnings | |
import numpy as np | |
import random | |
from deap import base, creator, tools, algorithms | |
from multiprocessing import Pool | |
from sklearn.base import clone, is_classifier | |
from sklearn.model_selection import check_cv | |
from sklearn.grid_search import BaseSearchCV | |
from sklearn.metrics.scorer import check_scoring |
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
""" github_orgy -- monitor github organizations for new repos. | |
Usage: | |
python3.5 github_orgy.py deepmind tensorflow facebookresearch google watson-developer-cloud | |
Or with cron: | |
@hourly /usr/bin/python github_orgy.py deepmind tensorflow facebookresearch google watson-developer-cloud | |
""" | |
import time | |
import os |
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
# add keyboard brightness | |
import time | |
from datetime import datetime | |
SLEEP_TIME = 0.5 | |
def write(n): | |
with open("/sys/class/backlight/gmux_backlight/brightness", "w") as f: | |
#print("new", n) |
OlderNewer