Skip to content

Instantly share code, notes, and snippets.

@chris3000
chris3000 / mastadon_setup.sh
Last active November 26, 2022 02:36
Full, semi-automated setup of Mastodon. Tested with Digital Ocean
#!/bin/bash
# ***** THIS IS NOT A BASH FILE THAT YOU CAN JUST RUN *********
# It will take some hand holding, and will reboot in the middle. You could probably break it in two and it would work ok.
# Lightly modified from https://www.learnlinux.tv/build-your-own-mastodon-server-on-debian-step-by-step-server-build-guide/
# https://www.youtube.com/watch?v=2a9YrLsE45Y
# What you’ll need
# * A domain from a registrar [I'm using hover.com]
# * A VPS instance, 4GB RAM recommended, Debian 11 [I'm using Digital Ocean]

Keybase proof

I hereby claim:

  • I am chris3000 on github.
  • I am chris3000 (https://keybase.io/chris3000) on keybase.
  • I have a public key whose fingerprint is 77C9 2AA4 3038 4993 765D 9CB7 8FE2 EABE 3490 E4C9

To claim this, I am signing this object:

@chris3000
chris3000 / extensions.conf
Last active August 29, 2015 14:07
send a "mood" picture to a user using the Twilio API
[ck987_mms]
exten => s,1,Background(/home/ck987/asterisk_sounds/moods)
same => n,WaitExten(10)
exten => 1,1,System(/home/ck987/ruby/mms_send.rb ${CALLERID(num)} grumpy)
same => n,Hangup
exten => 2,1,System(/home/ck987/ruby/mms_send.rb ${CALLERID(num)} happy)
same => n,Hangup
exten => 3,1,System(/home/ck987/ruby/mms_send.rb ${CALLERID(num)} excited)
same => n,Hangup
exten => 4,1,System(/home/ck987/ruby/mms_send.rb ${CALLERID(num)} sad)
@chris3000
chris3000 / passcode-generator.rb
Created August 5, 2014 16:53
Generates random password in easy-to-remember combinations
#!/usr/bin/ruby
#set amount of letters and numbers in passcode
num_len = 4
alpha_len = 4
#fill up alphabet array
a=[]
("a".."z").each {|v| a<<v}
#fill up number array
n=[]
("0".."9").each {|v| n<<v}
@chris3000
chris3000 / potemkin3000_player.rb
Created February 19, 2014 22:58
My admittedly mediocre battleship bot for Ruby Fight Club.
#require 'logger'
class Potemkin3000Player
HUNT = :hunt
STRIKE = :strike
DIR = [:up,:down,:right,:left]
attr_accessor :occupied, :fire_state, :strike_dir, :last_move, :first_hit, :last_ships_remaining
def name
"Battleship Potemkin 3000"
@chris3000
chris3000 / gist:4740404
Last active March 17, 2017 14:57
Check if Asterisk is running and notify by email if it's not.
#!/usr/bin/ruby
require 'pony' #pony gem takes care of email
require 'syslog' #syslog logs to /var/log/syslog, the core log file for Ubuntu.
def log(msg)
# $0 is the current script name
Syslog.open($0, Syslog::LOG_PID | Syslog::LOG_CONS) { |s| s.warning msg }
end
ps=`ps ax`
@chris3000
chris3000 / leavebot3000_stats.txt
Last active December 11, 2015 10:29
Leavebot3000 Stats for Hack and Tell
Found 909 links spread across 420 subreddits.
Top 10 subreddits:
"WTF", 61
"trees", 61
"funny", 34
"pics", 32
"LadyBoners", 30, #1 per capita
"atheism", 29
"aww", 16
@chris3000
chris3000 / ping_server.rb
Created July 10, 2012 19:00
remote server health check from Dreamhost Cron
#!/usr/bin/ruby
require 'net/http'
require 'net/smtp'
require 'uri'
require 'yaml'
#set up logger
require 'logger'
logger = Logger.new('/home/cdk888/scripts/logs/ping.log', 'daily')