Skip to content

Instantly share code, notes, and snippets.

View thcipriani's full-sized avatar

Tyler Cipriani thcipriani

View GitHub Profile
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }
.ef1,.f1 { color: #AA0000; } .eb1,.b1 { background-color: #AA0000; }
.ef2,.f2 { color: #00AA00; } .eb2,.b2 { background-color: #00AA00; }
.ef3,.f3 { color: #AA5500; } .eb3,.b3 { background-color: #AA5500; }
.ef4,.f4 { color: #0000AA; } .eb4,.b4 { background-color: #0000AA; }
.ef5,.f5 { color: #AA00AA; } .eb5,.b5 { background-color: #AA00AA; }
-- Lamest answer to http://www.seas.upenn.edu/~cis194/lectures.html HW1
toDigits :: Integer -> [Integer]
toDigits x
| x <= 0 = []
| otherwise = toDigits a ++ [b]
where
a = div x 10
b = mod x 10
double2nd :: [Integer] -> [Integer]
@thcipriani
thcipriani / Coffee Experiment.md
Last active September 18, 2022 07:31
Analysis of Extraction Yield for Coffee Brewing Methods
@thcipriani
thcipriani / greater_than_five
Created August 21, 2014 17:05
Find lines in file > 5 words
#!/usr/bin/env bash
while read line; do
if (( $(echo $line | wc -w) > 5 )); then
echo "$line is greater than 5 words"
fi
done < "$1"
@thcipriani
thcipriani / ds213j.md
Created September 8, 2014 20:13
Synology DS213J

Synology DS213J setup

Installing ipkg

Services:

  • synoservicecfg --list
  • synoservicecfg --restart [service]
  • synoservicecfg --status [service]
@thcipriani
thcipriani / Keys.md
Last active August 29, 2015 14:07
ssh public key

My Public Keys

I made a quick shortcut to share my public keys quickly and easily. This shortcut likely brought you to this place.

The goods

#!/bin/bash
printf "Enter OpenStack cloud password: "
read pass
# With the addition of Keystone, to use an openstack cloud you should
# authenticate against keystone, which returns a **Token** and **Service
# Catalog**. The catalog contains the endpoint for all services the
# user/tenant has access to - including nova, glance, keystone, swift.
#
<?php
if (false); {
echo "It's true, though!";
}
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # accept connections is in an ESTABLISHED or RELATED state
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP # drop tcp connections with NONE flag explicitly set
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP # drop tcp connects with the SYN bit set not in a new connection state
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP # drop tcp connections with no flags
iptables -A INPUT -i lo -j ACCEPT # accept connections on the loopback interface
iptables -A INPUT -p tcp -m tcp --dport [whatever] -j ACCEPT # accept connections to a specific port
iptables -P OUTPUT ACCEPT # default output policy, accept
iptables -P INPUT DROP # default input policy, drop
iptables-save > /etc/iptables.up.rules # save iptables rules to file
@thcipriani
thcipriani / setup.txt
Last active August 29, 2015 14:12
Server Setup
sshit --name root.[server] --host [host] --user root -x --agent
ssh root.[server]
sudo apt-get update && sudo apt-get dist-upgrade
vim /etc/hostname → [hostname]
vim /etc/hosts → 127.0.0.1 [hostname].fqdn [hostname] localhost
hostname -F /etc/hostname
# install security stuff and version control/building things
apt-get install fail2ban git logwatch ncurses-dev build-essential mercurial python-software-properties python-pip sendmail-bin libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev automake libevent-dev tree libluajit-5.1-dev liblua5.1-0-dev lua5.1 luajit-5.1 postfix heirloom-mailx