Skip to content

Instantly share code, notes, and snippets.

@hackertron
hackertron / server.py
Created September 8, 2017 07:29
weblog server in twisted
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, Factory
from webloglib import hit_tag, log_fields
import time
class WebLog(Protocol):
def connectionMade(self):
print "Connected from", self.transport.client
self.transport.write('<hits>')
self.ts = time.time()
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:angle="90"
android:centerColor="@color/colorPrimary"
android:endColor="@color/colorPrimary"
android:startColor="@color/colorPrimary" />
</shape>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/colorAccent"
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
</vector>
public class Restaurant {
private String name;
private String address;
private String rating;
private String cost;
private String imageUrl;
private String currency;
private double longitude;
public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.RestaurantHolder> {
private ArrayList<Restaurant> mData;
private Activity mACtivity;
public RestaurantAdapter(ArrayList<Restaurant> data, Activity activity) {
this.mData = data;
this.mACtivity = activity;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.fire.fire.pullingjsonresponseintorecyclerviewtutorial.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/restaurant_recycler"
package com.fire.fire.pullingjsonresponseintorecyclerviewtutorial;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
// This is a comment
/*
* Multi-line comment
*/
// Tells the compiler iostream library which contains the function cout
#include <iostream>
// Allows us to use vectors
#include <vector>
package javadriverexample;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedCondition;
import java.util.concurrent.TimeUnit;