Skip to content

Instantly share code, notes, and snippets.

View yottatsa's full-sized avatar

Atsuko Ito yottatsa

View GitHub Profile
def validate_token(self, token):
"""Validates a Fernet token and returns the payload attributes."""
# Convert v2 unicode token to a string
if not isinstance(token, six.binary_type):
token = token.encode('ascii')
#to
def validate_token(self, token):
"""Validates a Fernet token and returns the payload attributes."""
--- router_info.py 2015-10-12 15:56:54.571650341 +0000
+++ /usr/lib/python2.7/dist-packages/neutron/agent/l3/router_info.py 2015-10-12 15:28:24.090577334 +0000
@@ -361,7 +361,9 @@
LOG.debug('Spawning radvd daemon in router device: %s', self.router_id)
if not internal_ports:
internal_ports = self.internal_ports
- self.radvd.enable(internal_ports)
+ ex_gw_port = self.get_ex_gw_port()
+ ext_interface = self.get_external_device_interface_name(ex_gw_port)
+ self.radvd.enable(internal_ports, ext_interface)
class ConfigOpts(collections.Mapping):
"""Config options which may be set on the command line or in config files.
ConfigOpts is a configuration option manager with APIs for registering
option schemas, grouping options, parsing option values and retrieving
the values of options.
"""
def __init__(self):
__author__ = 'yottatsa'
import uuid
import random
MEASUREMENTS = 'Memory_used;Memory_free;Memory_cached;Net_tx;Net_rx;Net_recv;Net_send;Disk_read;Disk_write;CPU_user;CPU_system;CPU_iowait'.lower().split(
';')
def host(i):
package main
import (
"fmt"
"flag"
"strings"
"os"
"strconv"
"log"
"math/rand"
import requests
import logging
import os.path
class Graphite(object):
def __init__(self, url):
self.url = url
self.session = requests.Session()
class Solution:
# @param A : list of list of integers
# @return an integer
def edge(self, A, x, first=None):
left = first or 0
right = len(A)-1
found = False
if x < A[0]:
@yottatsa
yottatsa / netconsole
Last active April 11, 2017 10:44
netconsole hook
#!/bin/sh
#/etc/dhcp/dhclient-exit-hooks.d/netconsole
#/etc/network/if-up.d/netconsole
#/etc/network/if-down.d/netconsole
SYSFS_NETCONSOLE="/sys/kernel/config/netconsole"
NETCONSOLE_CONF="/etc/default/netconsole.conf"
NETCONSOLE_PORT="514"
netconsole_remove() {
for sysfsnc in "${SYSFS_NETCONSOLE}/${interface:-}-"*

Keybase proof

I hereby claim:

  • I am yottatsa on github.
  • I am yottatsa (https://keybase.io/yottatsa) on keybase.
  • I have a public key ASCeGfs5HvNtpqsRdZ0XuUGXk3MnkXTgITOxOC5HSyeE-wo

To claim this, I am signing this object:

@yottatsa
yottatsa / autoecrypt.sh
Last active January 15, 2018 23:13
Encrypt a message with s/mime and send key password back
alias openssl=/Users/yottatsa/.local/homebrew/Cellar/openssl/1.0.2l/bin/openssl
conf () {
echo "
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
[ req_distinguished_name ]