Skip to content

Instantly share code, notes, and snippets.

View vidia's full-sized avatar

David Tschida vidia

View GitHub Profile
@vidia
vidia / nginx-unificontroller.conf
Last active December 7, 2024 18:26
Example, working, NGINX config for proxying to Unifi Controller software and using letsencrypt. Includes websocket fix.
# 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;
@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;
@vidia
vidia / motd.sh
Created February 9, 2017 16:38
raspberrypi-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}
@vidia
vidia / activity_main.xml
Created September 29, 2016 19:25
State of the tutorial XML for the TextView tutorial
<?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"
#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):