Skip to content

Instantly share code, notes, and snippets.

View davidkrider's full-sized avatar

David Krider davidkrider

View GitHub Profile
@davidkrider
davidkrider / check_nagios.rb
Last active November 14, 2024 04:48
Check Nagios Script
#!/usr/bin/env ruby
require 'net/https'
require 'net/smtp'
username = 'username'
password = 'password'
# If you're accessing through SSL:
#http = Net::HTTP.new("nagios.domain.com", 443)
@davidkrider
davidkrider / find_uncommitted.rb
Created June 30, 2011 13:29
Rancid script to find uncommitted changes which would be lost on a reboot
#!/usr/bin/ruby
File.open("all/router.db").each do |line|
(device, type, state) = line.split(":")
if state == "up\n"
if type == "vyatta"
command = "~/bin/clogin"
written = `#{command} -c 'cat /opt/vyatta/etc/config/config.boot' #{device} > #{dev`
running = `#{command} -c 'show configuration' #{device} > #{device}.running`
else
@davidkrider
davidkrider / xorg.conf
Created September 28, 2011 13:59
My xorg.conf file
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 270.41.06 ([email protected]) Mon Apr 18 15:14:00 PDT 2011
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
@davidkrider
davidkrider / vrancid
Created November 7, 2012 16:12
RANCID for Vyatta
#! /usr/bin/perl
#
# usage: vrancid [-dV] [-l] [-f filename | hostname]
#
use Getopt::Std;
getopts('dflV');
if ($opt_V) {
print "rancid 2.3.6\n";
exit(0);
}
@davidkrider
davidkrider / Sublime User Prefs
Last active January 30, 2023 13:31
Sublime User Prefs
{
"color_scheme": "Monokai Pro.sublime-color-scheme",
"file_exclude_patterns":
[
"*.git",
"*tmp/cache",
"*._*",
"*.DS_Store",
],
"font_face": "Monaco",
@davidkrider
davidkrider / application.yml
Created June 21, 2018 17:58
Grails integration with SAML
---
grails:
profile: web
codegen:
defaultPackage: cddm
gorm:
reactor:
# Whether to translate GORM events into Reactor events
# Disabled by default for performance reasons
events: false
@davidkrider
davidkrider / devise.rb
Created February 24, 2019 14:43 — forked from bearded-avenger/devise.rb
Rails - SSO - WordPress - Authenticating against a WordPress install from a Rails site using oAuth
config.omniauth :wordpress_hosted, ENV['SSO_KEY'], ENV['SSO_SECRET'],
strategy_class: OmniAuth::Strategies::WordpressHosted,
client_options: { site: ENV['SSO_URL'] }
# This is a small script which talks with the Reddit API to do a search
# for a particular phrase. It can be cron'd to run on whatever schedule
# is appropriate.
# In this case, I was trying to find a set of PetSCII key caps for my
# mecahnical keyboard in /r/mechmarket. I've ultimately decided I don't
# want to spend the kind of money it would take to acquire a set, so I've
# stopped caring, but I wanted to save the script for posterity.
# Notably, this relies on the Python praw library to work.
@davidkrider
davidkrider / twitter_redact_mutes.js
Created May 26, 2021 20:30
Redact the placeholder for tweets with muted words
// ==UserScript==
// @name Twitter Redact Mutes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author dk
// @match ...
// @grant none
// ==/UserScript==
@davidkrider
davidkrider / grpo_demo.py
Created January 31, 2025 03:10 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset