Skip to content

Instantly share code, notes, and snippets.

View sammy8806's full-sized avatar

Steven Tappert sammy8806

View GitHub Profile
@j-a4
j-a4 / email_mx_validator.rb
Last active May 25, 2018 19:23
Email MX validator for Mastodon
# Validates that MX record exists for domain to prevent typos and also block by MX servers
# Use by adding to app/models/user.rb
# validates_with EmailMXValidator, if: :email_changed?
# frozen_string_literal: true
require 'resolv'
class EmailMXValidator < ActiveModel::Validator
def validate(user)
domain = user.email.split('@', 2).last
mxs = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }
@joyeusenoelle
joyeusenoelle / Mastodon.md
Last active January 23, 2024 02:43
An increasingly less-brief introduction to Mastodon
@Prof9
Prof9 / Readme.md
Last active February 1, 2024 07:02
THIS SCRIPT NO LONGER WORKS! Twitter has rolled out a fix for the web client hack. (Original text: Force enable cramming (280 character tweets) on Twitter. Use TamperMonkey. NOTE: Stops working when you switch pages, refresh to fix.)

As of 7 November 2017 everyone has access to 280 characters in supported clients, so you no longer need this script!

@ddrown
ddrown / etc_init.d_iface-colors
Last active November 5, 2016 20:09
Omnia router LED color based on bandwidth usage
#!/bin/sh /etc/rc.common
START=98
USE_PROCD=1
NAME=iface-colors
PROG=/root/iface-colors
start_service() {
procd_open_instance
@TobleMiner
TobleMiner / blaze
Last active December 28, 2016 06:26
dn42 OSPF setup: Lockdown is the peering vm, blaze is the primary router and connects to lockdown via interface dn42. 'some random dn42 enabled vm' is connected to blaze via interface dn42-gw.
protocol ospf dn42
{
table vm;
instance id 1;
export all;
import all;
area 0
{
interface "dn42"
{
@TobleMiner
TobleMiner / vfio-bind
Created April 10, 2016 14:41
VFIO binding service
#!/bin/sh
modprobe vfio-pci
for dev in "$@"; do
echo Handling device "$dev"
devpath="/sys/bus/pci/devices/$dev"
if ! [ -d $devpath ]; then
echo "$devpath doesn't exist"
exit 1
fi
if [ -L $devpath/driver/module ]; then
@elomatreb
elomatreb / autoexec.cfg
Last active September 27, 2018 07:03
my CSGO settings
// General
sensitivity 1.15 // 1200 DPI
zoom_sensitivity_ratio_mouse 1
cl_autowepswitch 0
cl_disablehtmlmotd 1
net_graph 1
net_graphpos 3
net_graphproportionalfont 0
viewmodel_offset_y 2
@TobleMiner
TobleMiner / gist:cde1825190f66893710d
Last active August 29, 2015 14:16
Dmesg human readable timestamps
#!/usr/bin/perl
use strict;
use warnings;
my @dmesg_new = ();
my $dmesg = "/bin/dmesg";
my @dmesg_old = `$dmesg`;
my $now = time();
my $uptime = `cat /proc/uptime | cut -d"." -f1`;
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@mildmojo
mildmojo / rotate_desktop.sh
Created June 18, 2014 06:47
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation