text:
Deskcom plugin for Fluentd
===========================

Fluentd Input plugin to collect data from Your Deskcom.
It is useful to improve your support quality.
This plugin is still experimental.
This plugin depends on [desk library](https://github.com/chriswarren/desk)
Also, please see [Desk API v2](http://dev.desk.com/)

## Quick Start

If you want to use fluent-plugin-deskcom on Heroku, you can start easily.
Please see the following page, and click Deploy to Heroku button!
https://github.com/toru-takahashi/heroku-td-agent

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'fluent-plugin-deskcom'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install fluent-plugin-deskcom

### Get Desk.com API key

Your Desk.com API key, secret, token and token secret can be found by following this guide:

1. Log in to your Desk.com admin panel using your personal URL (http://your-account.desk.com/admin).
2. Click on Settings:
![step2](http://gyazo.com/020298636ef217e0d3bb7ee7b6a0bd31.png)
3. From the left menu select API > My Applications.
4. If you don't already have an application defined for TreasureData, create one by clicking on the "Add API Application" button and enter the following information:
![step4-1](http://gyazo.com/803b486ed3a86c77af55819e83d4d85b.png)
![step4-2](http://gyazo.com/97a5624030f1bc05fe040e386d30f7dd.png)
5. Find your Key and Secret codes for the TreasureData API application:
![step5](http://gyazo.com/895bf963f01b65254e38c534855a1914.png)
6. Find your Token and Token secret by clicking on the Your Access Token link:
![step6](http://gyazo.com/7f057fb4b6b88b616f9895d4d5b69e9d.png)

## Usage

The followings are examples of fluentd.conf(td-agent.conf)

### Cases Config Sample

```ruby
<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/cases.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           cases                       # Optional (cases(default) or replies)
  tag                 deskcom.cases               # Required
  time_format         updated_at                  # Optional
</source>
```

```ruby
{
    "id": 150,
    "blurb": ": "",
    "priority": 4,
    "external_id": null,
    "locked_until": null,
    "label_ids": [],
    "active_at": null,
    "changed_at": "2013-02-10T14:18:56Z",
    "created_at": "2013-01-15T11:12:20Z",
    "updated_at": "2013-02-10T14:18:56Z",
    "first_opened_at": null,
    "opened_at": null,
    "first_resolved_at": "2013-01-27T13:54:13Z",
    "resolved_at": "2013-01-27T13:54:13Z",
    "status": "closed",
    "description": null,
    "language": null,
    "received_at": "2013-01-15T11:12:20Z",
    "type": "email",
    "labels": [],
    "subject": "Chat transcript: no operator and Japan #6642",
    "custom_fields": "{\"custom1_\":null,\"custom2_\":null}"
}
```

### Replies Config Sample

```ruby
<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/replies.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           replies                     # Optional (cases(default) or replies)
  tag                 deskcom.replies               # Required
</source>
```

```ruby
{
    "case_id": 1
    "id": 159057281,
    "created_at": "2013-01-14T22:18:14Z",
    "updated_at": "2013-01-14T22:18:14Z",
    "sent_at": null,
    "erased_at": null,
    "hidden_by": null,
    "hidden_at": null,
    "body": "",
    "from": "Toru Takahashi <torutakahashi.ayashi@gmail.com>",
    "to": "\"test user\" <test@user.co.jp>",
    "cc": "",
    "bcc": null,
    "client_type": "apple_mail",
    "direction": "in",
    "status": "received",
    "subject": "subject",
    "hidden": false
}
```

### Config Sample (Deskcom -> TreasureData)

```ruby
# fluent.conf
<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/cases.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           cases                       # Optional (cases(default) or replies)
  tag                 deskcom.cases               # Required
  time_column         updated_at
</source>

<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/replies.yml        # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           replies                     # Optional (cases(default) or replies)
  tag                 deskcom.replies             # Required
  time_column         created_at
</source>

<match **>
  type tdlog
  apikey TREASUREDATA_API_KEY

  auto_create_table
  buffer_path /var/log/td-agent/tdlog
</match>
```

## TO DO

- Allows over 2 input_api (Ex. input_api cases,replies)
- Add other input_api
- Add Rate Limits
- Add feature to remind last collect cases or replies when forced termination.

## Copyright

Copyright (c) 2014 Toru Takahashi

## License

MIT License


text:
__author__ = 'jonathanbrodie'
import eventconstant,ctypes
from hzclient.clientmessage import ClientMessage
from hzclient.codec.addresscodec import AddressCodec
from hzclient.codec.membercodec import MemberCodec
from hzclient.codec.membercodec import MemberAttributeChangeCodec

class ClientMessageType:
    CLIENT_AUTHENTICATION=0x2
    CLIENT_AUTHENTICATIONCUSTOM=0x3
    CLIENT_MEMBERSHIPLISTENER=0x4
    CLIENT_CREATEPROXY=0x5
    CLIENT_DESTROYPROXY=0x6
    CLIENT_GETPARTITIONS=0x8
    CLIENT_REMOVEALLLISTENERS=0x9
    CLIENT_ADDPARTITIONLOSTLISTENER=0xa
    CLIENT_REMOVEPARTITIONLOSTLISTENER=0xb
    CLIENT_GETDISTRIBUTEDOBJECT=0xc
    CLIENT_ADDDISTRIBUTEDOBJECTLISTENER=0xd
    CLIENT_REMOVEDISTRIBUTEDOBJECTLISTENER=0xe
    CLIENT_PING=0xf

    def ___init__(self, messageType):
        self.id = messageType

    def id(self):
        return self.id

class ClientAuthenticationCodec:
    REQUEST_TYPE = ClientMessageType.CLIENT_AUTHENTICATION
    RESPONSE_TYPE = 107
    RETRYABLE = True

    '''************************ REQUEST *************************'''

    class RequestParameters:
        def __init__(self):
            self.TYPE = ClientAuthenticationCodec.REQUEST_TYPE
            self.username=None
            self.password=None
            self.uuid=None
            self.ownerUuid=None
            self.isOwnerConnection=None
    @classmethod
    def encodeRequest(cls, username, password, uuid, ownerUuid, isOwnerConnection):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientAuthenticationCodec.REQUEST_TYPE)
        clientMessage.setRetryable(ClientAuthenticationCodec.RETRYABLE)
        clientMessage.set(username)
        clientMessage.set(password)
        uuid_isNull=None
        if uuid is None:
            uuid_isNull = True
            uuid_isNull=bytearray(ctypes.c_uint8(uuid_isNull))
            clientMessage.set(uuid_isNull)

        else:
            uuid_isNull= False
            uuid_isNull=bytearray(ctypes.c_uint8(uuid_isNull))
            clientMessage.set(uuid_isNull)
            clientMessage.set(uuid)
        ownerUuid_isNull=None
        if ownerUuid is None:
            ownerUuid_isNull = True
            ownerUuid_isNull=bytearray(ctypes.c_uint8(ownerUuid_isNull))
            clientMessage.set(ownerUuid_isNull)
        else:
            ownerUuid_isNull= False
            ownerUuid_isNull=bytearray(ctypes.c_uint8(ownerUuid_isNull))

            clientMessage.set(ownerUuid_isNull)
            clientMessage.set(ownerUuid)

        clientMessage.set(isOwnerConnection)
        clientMessage.updateSize()
        return clientMessage

    @classmethod
    def decodeRequest(cls, clientMessage):
        parameters = ClientAuthenticationCodec.RequestParameters()
        username=None
        username = clientMessage.extractStringFromPayload()
        parameters.username = username
        password=None
        password = clientMessage.extractStringFromPayload()
        parameters.password = password
        uuid=None
        uuid_isNull = clientMessage.extractBooleanFromPayload()
        if not uuid_isNull:
            uuid = clientMessage.extractStringFromPayload()
        parameters.uuid = uuid
        ownerUuid=None
        ownerUuid_isNull = clientMessage.extractBooleanFromPayload()
        if not ownerUuid_isNull:
            ownerUuid = clientMessage.extractStringFromPayload()
        parameters.ownerUuid = ownerUuid
        isOwnerConnection=None
        isOwnerConnection = clientMessage.extractBooleanFromPayload()
        parameters.isOwnerConnection = isOwnerConnection
        return parameters

    '''************************ RESPONSE *************************'''

    class ResponseParameters:
        def __init__(self):
            self.TYPE = ClientAuthenticationCodec.RESPONSE_TYPE
            self.address=None
            self.uuid=None
            self.ownerUuid=None

    @classmethod
    def decodeResponse(cls, clientMessage):
        parameters=ClientAuthenticationCodec.ResponseParameters()
        address=None
        address = AddressCodec.decode(clientMessage)
        parameters.address = address
        uuid=None
        uuid = clientMessage.extractStringFromPayload()
        parameters.uuid = uuid
        ownerUuid=None
        ownerUuid = clientMessage.extractStringFromPayload()
        parameters.ownerUuid = ownerUuid

        return parameters

class ClientMembershipListenerCodec:
    REQUEST_TYPE = ClientMessageType.CLIENT_MEMBERSHIPLISTENER
    RESPONSE_TYPE = 104
    RETRYABLE = False

    '''************************ REQUEST *************************'''

    class RequestParameters:
        def __init__(self):
            self.TYPE = ClientMembershipListenerCodec.REQUEST_TYPE
    @classmethod
    def encodeRequest(cls, ):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientMembershipListenerCodec.REQUEST_TYPE)
        clientMessage.setRetryable(ClientMembershipListenerCodec.RETRYABLE)
        clientMessage.updateSize()
        return clientMessage

    @classmethod
    def decodeRequest(cls, clientMessage):
        parameters = ClientMembershipListenerCodec.RequestParameters()
        return parameters

    '''************************ RESPONSE *************************'''

    class ResponseParameters:
        def __init__(self):
            self.TYPE = ClientMembershipListenerCodec.RESPONSE_TYPE
            self.response=None
    @classmethod
    def encodeResponse(cls, response):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientMembershipListenerCodec.RESPONSE_TYPE)
        clientMessage.set(response)

        return clientMessage
    @classmethod
    def decodeResponse(cls, clientMessage):
        parameters=ClientMembershipListenerCodec.ResponseParameters()
        response=None
        response = clientMessage.extractStringFromPayload()
        parameters.response = response

        return parameters

    '''************************ EVENTS *************************'''

    class EventHandler:
        def __init__(self,handler):
            self.handler=handler
        def handle(self, clientMessage):
            messageType = clientMessage.getOperationType()
            if (messageType == eventconstant.EVENT_MEMBER):
                member=None
                member = MemberCodec.decode(clientMessage)
                eventType=None
                eventType = clientMessage.extractIntFromPayload()
                self.handler.handle(member, eventType)
                return
            if (messageType == eventconstant.EVENT_MEMBERSET):
                members=None
                members_size = clientMessage.extractIntFromPayload()
                members = []
                for i in range(members_size):
                    members_item=None
                    members_item = MemberCodec.decode(clientMessage)
                    members.append(members_item)
                self.handler.handle(members)
                return
            if (messageType == eventconstant.EVENT_MEMBERATTRIBUTECHANGE):
                memberAttributeChange=None
                memberAttributeChange = MemberAttributeChangeCodec.decode(clientMessage)
                self.handler.handle(memberAttributeChange)
                return

class ClientGetPartitionsCodec:
    REQUEST_TYPE = ClientMessageType.CLIENT_GETPARTITIONS
    RESPONSE_TYPE = 108
    RETRYABLE = False

    '''************************ REQUEST *************************'''

    class RequestParameters:
        def __init__(self):
            self.TYPE = ClientGetPartitionsCodec.REQUEST_TYPE
    @classmethod
    def encodeRequest(cls, ):
        """

        :rtype : ClientMessage
        """
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientGetPartitionsCodec.REQUEST_TYPE)
        clientMessage.setRetryable(ClientGetPartitionsCodec.RETRYABLE)
        clientMessage.updateSize()
        return clientMessage

    @classmethod
    def decodeRequest(cls, clientMessage):
        parameters = ClientGetPartitionsCodec.RequestParameters()
        return parameters

    '''************************ RESPONSE *************************'''

    class ResponseParameters:
        def __init__(self):
            self.TYPE = ClientGetPartitionsCodec.RESPONSE_TYPE
            self.members=None
            self.index=None

    @classmethod
    def decodeResponse(cls, clientMessage):
        parameters=ClientGetPartitionsCodec.ResponseParameters()
        members=[]
        members_size=clientMessage.extractIntFromPayload()
        for i in range(members_size):
            member=AddressCodec.decode(clientMessage)
            members.append(member)
        parameters.members=members

        partitions_val_size = clientMessage.extractIntFromPayload()
        partitions_val = []
        for i in range(partitions_val_size):
                partitions_val_item = clientMessage.extractIntFromPayload()
                partitions_val.append(partitions_val_item)
        parameters.index = partitions_val

        return parameters

class ClientAddPartitionLostListenerCodec:
    REQUEST_TYPE = ClientMessageType.CLIENT_ADDPARTITIONLOSTLISTENER
    RESPONSE_TYPE = 104
    RETRYABLE = True

    '''************************ REQUEST *************************'''

    class RequestParameters:
        def __init__(self):
            self.TYPE = ClientAddPartitionLostListenerCodec.REQUEST_TYPE
    @classmethod
    def encodeRequest(cls, ):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientAddPartitionLostListenerCodec.REQUEST_TYPE)
        clientMessage.setRetryable(ClientAddPartitionLostListenerCodec.RETRYABLE)
        clientMessage.updateSize()
        return clientMessage

    @classmethod
    def decodeRequest(cls, clientMessage):
        parameters = ClientAddPartitionLostListenerCodec.RequestParameters()
        return parameters

    '''************************ RESPONSE *************************'''

    class ResponseParameters:
        def __init__(self):
            self.TYPE = ClientAddPartitionLostListenerCodec.RESPONSE_TYPE
            self.response=None
    @classmethod
    def encodeResponse(cls, response):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientAddPartitionLostListenerCodec.RESPONSE_TYPE)
        clientMessage.set(response)

        return clientMessage
    @classmethod
    def decodeResponse(cls, clientMessage):
        parameters=ClientAddPartitionLostListenerCodec.ResponseParameters()
        response=None
        response = clientMessage.extractStringFromPayload()
        parameters.response = response

        return parameters

    '''************************ EVENTS *************************'''
    #this doesn't need to be used
    @classmethod
    def encodePartitionLostEvent(cls, partitionId, lostBackupCount, source):
        clientMessage=ClientMessage()
        clientMessage.setOperationType(eventconstant.EVENT_PARTITIONLOST)
        clientMessage.setEventFlag()
        clientMessage.set(partitionId)
        clientMessage.set(lostBackupCount)
        source_isNull=None
        if source is None:
            source_isNull = True
            clientMessage.set(source_isNull)
        else:
            source_isNull= False
            clientMessage.set(source_isNull)
        #AddressCodec.encode(source, clientMessage)
        return clientMessage

    class EventHandler:
        def __init__(self,handler):
            self.handler=handler
        def handle(self, clientMessage):
            messageType = clientMessage.getOperationType()
            if (messageType == eventconstant.EVENT_PARTITIONLOST):
                partitionId=None
                partitionId = clientMessage.extractIntFromPayload()
                lostBackupCount=None
                lostBackupCount = clientMessage.extractIntFromPayload()
                source=None
                source_isNull = clientMessage.extractBooleanFromPayload()
                if not source_isNull:
                    source = AddressCodec.decode(clientMessage)
                self.handler.handle(partitionId, lostBackupCount, source)
                return
class ClientPingCodec:
    REQUEST_TYPE = ClientMessageType.CLIENT_PING
    RESPONSE_TYPE = 100
    RETRYABLE = True

    '''************************ REQUEST *************************'''

    class RequestParameters:
        def __init__(self):
            self.TYPE = ClientPingCodec.REQUEST_TYPE
    @classmethod
    def encodeRequest(cls, ):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientPingCodec.REQUEST_TYPE)
        clientMessage.setRetryable(ClientPingCodec.RETRYABLE)
        clientMessage.updateSize()
        return clientMessage

    @classmethod
    def decodeRequest(cls, clientMessage):
        parameters = ClientPingCodec.RequestParameters()
        return parameters

    '''************************ RESPONSE *************************'''

    class ResponseParameters:
        def __init__(self):
            self.TYPE = ClientPingCodec.RESPONSE_TYPE
    @classmethod
    def encodeResponse(cls, ):
        clientMessage = ClientMessage()
        clientMessage.setOperationType(ClientPingCodec.RESPONSE_TYPE)

        return clientMessage
    @classmethod
    def decodeResponse(cls, clientMessage):
        parameters=ClientPingCodec.ResponseParameters()

        return parameters

redpajama_set_name: RedPajamaGithub


text:
[![Build Status](https://travis-ci.org/helpdotcom/strip-falsy.svg)](https://travis-ci.org/helpdotcom/strip-falsy)
[![Coverage Status](https://coveralls.io/repos/helpdotcom/strip-falsy/badge.svg?branch=master&service=github)](https://coveralls.io/github/helpdotcom/strip-falsy?branch=master)

Strip falsy properties from an object.

**Note: The package actually creates a new object that has all of the**
**non-falsy properties of the input instead of deleting the properties.**
**This is done for performance reasons.**

## Install

```bash
$ npm install --save strip-falsy
```

## Usage

```js
var strip = require('strip-falsy')
var input = {
  a: false
, b: 0
, c: null
, d: undefined
, e: ''
, f: 'biscuits'
, g: '0'
}
var out = strip(input)
// => { f: 'biscuits', g: '0' }
```

## Test

```bash
$ npm test
```

## Author

Evan Lucas

## License

MIT (See `LICENSE` for more info)


text:
package com.intellij.externalDependencies;

import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * Stores list of external dependencies which are required for project to operate normally. Currently only one kind of dependencies
 * is supported ({@link DependencyOnPlugin}) but in future it may also store required JDKs, application servers and generic path variables.
 *
 * @author nik
 */
public abstract class ExternalDependenciesManager {
  public static ExternalDependenciesManager getInstance(@NotNull Project project) {
    return ServiceManager.getService(project, ExternalDependenciesManager.class);
  }

  @NotNull
  public abstract <T extends ProjectExternalDependency> List<T> getDependencies(@NotNull Class<T> aClass);

  @NotNull
  public abstract List<ProjectExternalDependency> getAllDependencies();

  public abstract void setAllDependencies(@NotNull List<ProjectExternalDependency> dependencies);
}


text:
/**
 * Support and FAQ: visit Atmel Support
 */
#ifndef CONF_EXAMPLE_H_INCLUDED
#define CONF_EXAMPLE_H_INCLUDED

/* Using D10 SAM4C-EK (PC6) */
#define EXAMPLE_LED LED0_GPIO

/* Using button BP5 on SAM4C-EK (PA20) */
#define EXAMPLE_BUTTON GPIO_PUSH_BUTTON_1

#endif /* CONF_EXAMPLE_H_INCLUDED */


text:
Pipeline View & Probe
=======================

Pipeline provides a pair of commands: lineview and lineprobe. Together,
they make it easy to view streams of data in real time from the command line.

Lineview combines SocketServer to manage client connections and pylab to plot
and display data. Multiple lineprobe clients can connect to a single server.

`lineview.py`

* Lineview is a threaded display server. It supports a simple, text-based
  protocol, implemented by lineprobe.

  See: `lineview.py --helpshort` for more detailed usage notes.

`lineprobe.py`

* Lineprobe is a command line client that sends values to the lineview
  server. By default, lineprobe reads from stdin.  However, lineprobe can
  also run a command and read the command output instead.

  See: `lineprobe.py --helpshort` for more detailed usage notes.

Install
=======

Pipeline has two dependencies on third-party modules:

 * [matplotlib](http://www.matplotlib.org/)
  - packaged as python-matplotlib or py-matplotlib or similar.
 * [gflags](https://code.google.com/p/python-gflags/)
  - packaged as python-gflags or py-gflags or similar.

Example
=======

![Pipeline Example](https://github.com/stephen-soltesz/pipeline/raw/master/screenshots/example.png)

The above example was created using commands like those below.

First, start the server:

    ./lineview.py --timestamp

Next run a lineprobe for each line. Please note that the lineprobe commands
expect scripts `sysctl.py` and `cpu.py` which return a single floating point
value and exit.

    LAB=("1" "5" "15")
    for i in 0 1 2 ; do
      ./lineprobe.py --axis_ylabel "Load Average" \
          --label load${LAB[$i]} \
          --command "./sysctl.py $i" &
      sleep 10
    done

Finally, read cpu load from stdin and add to a new axis named "cpu_pct".

    LAB=("sys" "user")
    for i in 0 1 ; do
      ./cpu.py ${LAB[$i]} | ./lineprobe.py --axis_ylabel "% Load" \
          --label ${LAB[$i]} \
          --axis cpu_pct &
      sleep 1
    done


text:
layout: post
categories: [music, albums]
share: true
comments: true
title: 'New albums released in 2017'
#excerpt: 'A timeline of favorite albums released in 2017. The list gets updated throughout the year.'
date: '2017-01-08T18:15:00+02:00'
modified: '2017-12-31T21:57:00+02:00'
tags: [albums]
author: Micronaut
hidelogo: true
enable_chat: true
relatedposts:
 - url: /music/blogovision/blogovision2017/no01/
 - url: /music/albums/2016/
 - url: /music/albums/2015/
xmldata:
  data: /docs/xmldata/albums/albums2017.xml
  template: timelinejs
image:
  thumbnail: /images/posts/band.png
redirect_from: "/music/new-albums-2017/"
---
Here is a weekly-updated timeline of (so far #) albums released within 2017 which fit our taste; in fact this is our captain's logbook of the year. The spectrum of genres is rather wide, yet all albums can be commonly described as *alternative music*. We advice you to not only scroll through but also listen to the songs. You have any recommendations? We would be more than happy to read your comments and include your proposals into this list. Don't waste time... start listening and have fun.

**Note:** You may freely reuse and redistribute this list of albums. You can download a copy in xml format [here]({{ page.xmldata.data }}){:target="_blank"}.
{:.notice}

**Note:** By any means, always show your support to independent artists and labels.
{:.notice}


text:
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <unistd.h>

#ifdef ANDROID
#define LOG_TAG "DHCP"
#include <log/log.h>
#else
#include <stdio.h>
#define ALOGD printf
#define ALOGW printf
#endif

#include "dhcpmsg.h"

int fatal();

int open_raw_socket(const char *ifname __attribute__((unused)), uint8_t *hwaddr, int if_index)
{
    int s;
    struct sockaddr_ll bindaddr;

    if((s = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
        return fatal("socket(PF_PACKET)");
    }

    memset(&bindaddr, 0, sizeof(bindaddr));
    bindaddr.sll_family = AF_PACKET;
    bindaddr.sll_protocol = htons(ETH_P_IP);
    bindaddr.sll_halen = ETH_ALEN;
    memcpy(bindaddr.sll_addr, hwaddr, ETH_ALEN);
    bindaddr.sll_ifindex = if_index;

    if (bind(s, (struct sockaddr *)&bindaddr, sizeof(bindaddr)) < 0) {
        return fatal("Cannot bind raw socket to interface");
    }

    return s;
}

static uint32_t checksum(void *buffer, unsigned int count, uint32_t startsum)
{
    uint16_t *up = (uint16_t *)buffer;
    uint32_t sum = startsum;
    uint32_t upper16;

    while (count > 1) {
        sum += *up++;
        count -= 2;
    }
    if (count > 0) {
        sum += (uint16_t) *(uint8_t *)up;
    }
    while ((upper16 = (sum >> 16)) != 0) {
        sum = (sum & 0xffff) + upper16;
    }
    return sum;
}

static uint32_t finish_sum(uint32_t sum)
{
    return ~sum & 0xffff;
}

int send_packet(int s, int if_index, struct dhcp_msg *msg, int size,
                uint32_t saddr, uint32_t daddr, uint32_t sport, uint32_t dport)
{
    struct iphdr ip;
    struct udphdr udp;
    struct iovec iov[3];
    uint32_t udpsum;
    uint16_t temp;
    struct msghdr msghdr;
    struct sockaddr_ll destaddr;

    ip.version = IPVERSION;
    ip.ihl = sizeof(ip) >> 2;
    ip.tos = 0;
    ip.tot_len = htons(sizeof(ip) + sizeof(udp) + size);
    ip.id = 0;
    ip.frag_off = 0;
    ip.ttl = IPDEFTTL;
    ip.protocol = IPPROTO_UDP;
    ip.check = 0;
    ip.saddr = saddr;
    ip.daddr = daddr;
    ip.check = finish_sum(checksum(&ip, sizeof(ip), 0));

    udp.source = htons(sport);
    udp.dest = htons(dport);
    udp.len = htons(sizeof(udp) + size);
    udp.check = 0;

    /* Calculate checksum for pseudo header */
    udpsum = checksum(&ip.saddr, sizeof(ip.saddr), 0);
    udpsum = checksum(&ip.daddr, sizeof(ip.daddr), udpsum);
    temp = htons(IPPROTO_UDP);
    udpsum = checksum(&temp, sizeof(temp), udpsum);
    temp = udp.len;
    udpsum = checksum(&temp, sizeof(temp), udpsum);

    /* Add in the checksum for the udp header */
    udpsum = checksum(&udp, sizeof(udp), udpsum);

    /* Add in the checksum for the data */
    udpsum = checksum(msg, size, udpsum);
    udp.check = finish_sum(udpsum);

    iov[0].iov_base = (char *)&ip;
    iov[0].iov_len = sizeof(ip);
    iov[1].iov_base = (char *)&udp;
    iov[1].iov_len = sizeof(udp);
    iov[2].iov_base = (char *)msg;
    iov[2].iov_len = size;
    memset(&destaddr, 0, sizeof(destaddr));
    destaddr.sll_family = AF_PACKET;
    destaddr.sll_protocol = htons(ETH_P_IP);
    destaddr.sll_ifindex = if_index;
    destaddr.sll_halen = ETH_ALEN;
    memcpy(destaddr.sll_addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN);

    msghdr.msg_name = &destaddr;
    msghdr.msg_namelen = sizeof(destaddr);
    msghdr.msg_iov = iov;
    msghdr.msg_iovlen = sizeof(iov) / sizeof(struct iovec);
    msghdr.msg_flags = 0;
    msghdr.msg_control = 0;
    msghdr.msg_controllen = 0;
    return sendmsg(s, &msghdr, 0);
}

int receive_packet(int s, struct dhcp_msg *msg)
{
    int nread;
    int is_valid;
    struct dhcp_packet {
        struct iphdr ip;
        struct udphdr udp;
        struct dhcp_msg dhcp;
    } packet;
    int dhcp_size;
    uint32_t sum;
    uint16_t temp;
    uint32_t saddr, daddr;

    nread = read(s, &packet, sizeof(packet));
    if (nread < 0) {
        return -1;
    }
    /*
     * The raw packet interface gives us all packets received by the
     * network interface. We need to filter out all packets that are
     * not meant for us.
     */
    is_valid = 0;
    if (nread < (int)(sizeof(struct iphdr) + sizeof(struct udphdr))) {
#if VERBOSE
        ALOGD("Packet is too small (%d) to be a UDP datagram", nread);
#endif
    } else if (packet.ip.version != IPVERSION || packet.ip.ihl != (sizeof(packet.ip) >> 2)) {
#if VERBOSE
        ALOGD("Not a valid IP packet");
#endif
    } else if (nread < ntohs(packet.ip.tot_len)) {
#if VERBOSE
        ALOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len));
#endif
    } else if (packet.ip.protocol != IPPROTO_UDP) {
#if VERBOSE
        ALOGD("IP protocol (%d) is not UDP", packet.ip.protocol);
#endif
    } else if (packet.udp.dest != htons(PORT_BOOTP_CLIENT)) {
#if VERBOSE
        ALOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest));
#endif
    } else {
        is_valid = 1;
    }

    if (!is_valid) {
        return -1;
    }

    /* Seems like it's probably a valid DHCP packet */
    /* validate IP header checksum */
    sum = finish_sum(checksum(&packet.ip, sizeof(packet.ip), 0));
    if (sum != 0) {
        ALOGW("IP header checksum failure (0x%x)", packet.ip.check);
        return -1;
    }
    /*
     * Validate the UDP checksum.
     * Since we don't need the IP header anymore, we "borrow" it
     * to construct the pseudo header used in the checksum calculation.
     */
    dhcp_size = ntohs(packet.udp.len) - sizeof(packet.udp);
    saddr = packet.ip.saddr;
    daddr = packet.ip.daddr;
    nread = ntohs(packet.ip.tot_len);
    memset(&packet.ip, 0, sizeof(packet.ip));
    packet.ip.saddr = saddr;
    packet.ip.daddr = daddr;
    packet.ip.protocol = IPPROTO_UDP;
    packet.ip.tot_len = packet.udp.len;
    temp = packet.udp.check;
    packet.udp.check = 0;
    sum = finish_sum(checksum(&packet, nread, 0));
    packet.udp.check = temp;
    if (!sum)
        sum = finish_sum(sum);
    if (temp != sum) {
        ALOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp);
        return -1;
    }
    memcpy(msg, &packet.dhcp, dhcp_size);
    return dhcp_size;
}


text:
<!doctype html>

    <meta charset="UTF-8">
    <title>{{page.title}} · SharkPup</title>
    <meta name="description" content="SharkPup is your home for all shark adoption and knowledge needs.">
    <meta name="keywords" content="shark, fin, pup, baby, adopt, adoption, knowledge, aware, awareness">
    <meta name="author" content="Anita Chanthavong">
    <meta name="copyright" content="Anita Chanthavong 2014">
    <meta name="ICBM" content="N/E = positive, S/W = negative">
	<meta name="handheldfriendly" content="true">
	<meta name="mobileoptimized" content="240">
	<meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="http://fonts.googleapis.com/css?family=Economica:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Coustard:400,900" rel="stylesheet" type="text/css">
    <link href="{{site.baseurl}}/css/shark-pup.css" rel="stylesheet">
    <link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
    <link rel="shortcut icon" href="{{site.baseurl}}/images/logo.svg"/>

SharkPup

learn · adopt · educate

        Navigation

Home

About

Adopt

        <form action="{{site.baseurl}}/search/" method="get" class="f" role="search">
            Search Whatever
        <input type="search" id="search" placeholder="Search the site..." />
            <input type="submit" class="btn search-submit" value="Go!">
        </form>

{% if page.showbanner %}

{{page.bannertext}}

{% endif %}

{{content}}

Connect with us!

Facebook

Twitter

Instagram

Browse

Home

About

Adopt

SharkPup © 2014 Copyright Anita Chanthavong. All Rights Reserved.


text:
import { IInfoEntities } from './../panel/api/PanelSchema';
import { combineReducers } from 'redux';
import counters from '../counter/CounterReducer';
import profiles from '../profile/ProfileReducer';
import panels from '../panel/PanelReducer';
import loadingProgress, { IState as loadingProgressState } from '../loading/LoadingReducer';
import CounterActions from '../counter/CounterActions';
import ProfileActions from '../profile/ProfileActions';

export interface IReducers {
    counters: typeof CounterActions,
    profiles: typeof ProfileActions,
    panels: IInfoEntities,
    loadingProgress: loadingProgressState
}

export default combineReducers({
    counters,
    profiles,
    panels,
    loadingProgress
});


text:
from itertools import count
from math import sqrt
from collections import Counter
puz_input = 33100000

factor_count = Counter()
def get_factors(n):
    global factor_count
    def check_count(factor, flist):
        if factor_count[factor] > 50:
            pass
        else:
            factor_count[factor] += 1
            flist.add(factor)
    root = sqrt(n)
    i = 2
    factors = set([1, n])
    while i <= root:
        if n % i == 0:
            check_count(i, factors)
            div = (n//i)
            check_count(div, factors)
        i += 1
    return factors

for house in count(1,1):
    x = sum([ i * 11 for i in get_factors(house)])
    if x >= puz_input:
        print(house)
        break


text:
<?php

namespace Google\Site_Kit\Core\Storage;

/**
 * Class responsible for encrypting and decrypting data.
 *
 * @since 1.0.0
 * @access private
 * @ignore
 */
final class Data_Encryption {

	/**
	 * Key to use for encryption.
	 *
	 * @since 1.0.0
	 * @var string
	 */
	private $key;

	/**
	 * Salt to use for encryption.
	 *
	 * @since 1.0.0
	 * @var string
	 */
	private $salt;

	/**
	 * Constructor.
	 *
	 * @since 1.0.0
	 */
	public function __construct() {
		$this->key  = $this->get_default_key();
		$this->salt = $this->get_default_salt();
	}

	/**
	 * Encrypts a value.
	 *
	 * If a user-based key is set, that key is used. Otherwise the default key is used.
	 *
	 * @since 1.0.0
	 *
	 * @param string $value Value to encrypt.
	 * @return string|bool Encrypted value, or false on failure.
	 */
	public function encrypt( $value ) {
		if ( ! extension_loaded( 'openssl' ) ) {
			return $value;
		}

		$method = 'aes-256-ctr';
		$ivlen  = openssl_cipher_iv_length( $method );
		$iv     = openssl_random_pseudo_bytes( $ivlen );

		$raw_value = openssl_encrypt( $value . $this->salt, $method, $this->key, 0, $iv );
		if ( ! $raw_value ) {
			return false;
		}

		return base64_encode( $iv . $raw_value );
	}

	/**
	 * Decrypts a value.
	 *
	 * If a user-based key is set, that key is used. Otherwise the default key is used.
	 *
	 * @since 1.0.0
	 *
	 * @param string $raw_value Value to decrypt.
	 * @return string|bool Decrypted value, or false on failure.
	 */
	public function decrypt( $raw_value ) {
		if ( ! extension_loaded( 'openssl' ) ) {
			return $raw_value;
		}

		$raw_value = base64_decode( $raw_value, true );

		$method = 'aes-256-ctr';
		$ivlen  = openssl_cipher_iv_length( $method );
		$iv     = substr( $raw_value, 0, $ivlen );

		$raw_value = substr( $raw_value, $ivlen );

		$value = openssl_decrypt( $raw_value, $method, $this->key, 0, $iv );
		if ( ! $value || substr( $value, - strlen( $this->salt ) ) !== $this->salt ) {
			return false;
		}

		return substr( $value, 0, - strlen( $this->salt ) );
	}

	/**
	 * Gets the default encryption key to use.
	 *
	 * @since 1.0.0
	 *
	 * @return string Default (not user-based) encryption key.
	 */
	private function get_default_key() {
		if ( defined( 'GOOGLESITEKIT_ENCRYPTION_KEY' ) && '' !== GOOGLESITEKIT_ENCRYPTION_KEY ) {
			return GOOGLESITEKIT_ENCRYPTION_KEY;
		}

		if ( defined( 'LOGGED_IN_KEY' ) && '' !== LOGGED_IN_KEY ) {
			return LOGGED_IN_KEY;
		}

		// If this is reached, you're either not on a live site or have a serious security issue.
		return 'das-ist-kein-geheimer-schluessel';
	}

	/**
	 * Gets the default encryption salt to use.
	 *
	 * @since 1.0.0
	 *
	 * @return string Encryption salt.
	 */
	private function get_default_salt() {
		if ( defined( 'GOOGLESITEKIT_ENCRYPTION_SALT' ) && '' !== GOOGLESITEKIT_ENCRYPTION_SALT ) {
			return GOOGLESITEKIT_ENCRYPTION_SALT;
		}

		if ( defined( 'LOGGED_IN_SALT' ) && '' !== LOGGED_IN_SALT ) {
			return LOGGED_IN_SALT;
		}

		// If this is reached, you're either not on a live site or have a serious security issue.
		return 'das-ist-kein-geheimes-salz';
	}
}


text:
package com.tle.admin.controls.mypages.universal;

import com.tle.admin.controls.universal.UniversalControlSettingPanel;
import com.tle.common.wizard.controls.universal.UniversalSettings;

/** @author Aaron */
public class MyPagesSettingsPanel extends UniversalControlSettingPanel {
  @SuppressWarnings("nls")
  @Override
  protected String getTitleKey() {
    return getKey("mypages.settings.title");
  }

  @Override
  public void load(UniversalSettings state) {}

  @Override
  public void removeSavedState(UniversalSettings state) {}

  @Override
  public void save(UniversalSettings state) {}
}