View nginx-unificontroller.conf
# I had a bit of trouble getting my unifi controller (hosted offsite) to use a proxy/letsencrypt. So here are the fruits of my labor. | |
# The unifi default port is 8443 running on localhost. | |
# License: CC0 (Public Domain) | |
server { | |
# SSL configuration | |
# | |
listen 443 ssl default_server; | |
listen [::]:443 ssl default_server; |
View NodeItemsRecyclerAdapter.java
@ColorInt | |
private int getColorForNode(Node node) { | |
//Set the color of the node item. | |
if(node.getEdges().getIn().length <= 1 && node.getEdges().getOut().length <= 1) { | |
//This is either a green process or a yes/no question answer. | |
//we need to check the previous node to see what we are. | |
Node[] previousNodes = mAlgorithmGraph.getPreviousNodes(node); | |
if(previousNodes.length == 0) { | |
//this is the first node, so it has to be a process at this point. | |
return 0x8BCCA5; |
View motd.sh
#!/bin/bash | |
# This is a fork of https://github.com/gagle/raspberrypi-motd that addresses issue #6. | |
function color (){ | |
echo "\e[$1m$2\e[0m" | |
} | |
function extend (){ | |
local str="$1" | |
let spaces=60-${#1} |
View activity_main.xml
<?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" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" |
View gist:54c560f5b04be51e812b
#Non-recursive | |
def Main(): | |
n=eval(input("n?") | |
fact = 1 | |
for i in range(n,1,-1): | |
fact=fact*i | |
print("The factorial of",n,"is:", fact) | |
# Recursive | |
def fact(n): |