sudo apt-get install heirloom-mail
- config your email address and MTA server in
send-mail.sh
sudo cp send-mail.sh /opt/send-mail.sh
sudo cp dummy.* /etc/systemd/system/
- execute
sudo systemctl start dummy.service
to confirm it works. sudo systemctl start dummy.timer
- Check the schedule via
systemctl list-timers
This file contains 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
#include <Python.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/ioctl.h> | |
#include <sys/mtio.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <linux/input.h> | |
char* getDeviceName(char* device, char* name, size_t len) |
This file contains 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
alist = [[1,1],[1,1]] | |
assert([1, 1] == [x for x, y in alist]) # OK | |
for x, y in alist: # OK | |
assert x == 1 | |
assert([1, 1] == list(map(lambda x, y: x, alist))) # TypeError: <lambda>() missing 1 required positional argument: 'y' |
Sometimes a python script will simply hang forever with no indication of where things went wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward. Here's a way to see where the program is currently stuck.
Install gdb.
# Redhat, CentOS, etc
I largely followed Florin's blog post, but have a few notes to add regarding issues I encountered:
- I used a YubiKey 4, while the blog describes using a YubiKey NEO. I'm sure a YubiKey 5 would also work. I'm also running macOS 10.13.6.
- I installed GPGTools as recommended. However, as I'll note later, it seems that
gpg-agent
only automatically starts when gpg is used; for ssh, you'll need to ensure it's running. - Before generating your keys, decide what key size you want to use. If you run the
list
command insidegpg --edit-card
, look for theKey attributes
line to see what is currently selected. On my YubiKey 4, it defaulted to 2048 bits for all keys:
Key attributes ...: rsa2048 rsa2048 rsa2048
This file contains 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
# install phantomjs on ubuntu 16.04.4 | |
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
sudo cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/ | |
phantomjs --version | |
sudo cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/ |
This file contains 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
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose |
This file contains 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
@startuml | |
skinparam handwritten true | |
"You/Browser" -> slack.com: 1. I would like to access my files on Google Drive via your interface. | |
slack.com -> "You/Browser": 2. You should apply the "Authorization Code" from Google for me first. | |
"You/Browser" -> account.google.com: 3. I would like to permit slack.com to access my files. | |
account.google.com -> "You/Browser": 4. Are you sure? | |
"You/Browser" -> account.google.com: 5. [Y] | |
account.google.com -> "You/Browser": 6. Okay. Here is the "Authorization Code." Plz give it back to slack.com now. | |
"You/Browser" -> slack.com: 7. You can do what I asked now (with the Authorization Code which is just received from Google.) | |
slack.com -> account.google.com: 8. I would like to exchange the "Authorization Code" for the "Access Token." |
This file contains 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
from confluent_kafka import Consumer, KafkaError | |
c = Consumer({ | |
'bootstrap.servers': 'mybroker', | |
'group.id': 'mygroup', | |
'auto.offset.reset': 'largest' | |
}) | |
c.subscribe(['mytopic'], on_assign=print_assignment) # do not thing here |
This file contains 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
from functools import wraps | |
from multiprocessing import Lock | |
def synchronized(tlockname): | |
"""A decorator to place an instance based lock around a method """ | |
def _synched(func): | |
@wraps(func) | |
def _synchronizer(self, *args, **kwargs): | |
tlock = self.__getattribute__(tlockname) |