Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / github-team.py
Last active Aug 7, 2021
Python script to add all GitHub repositories to an organization team - permission is set to push. You'll need a settings.py file with your organization name and API key. Based off of my GitHub stats script (requirements.txt here): https://github.com/krues8dr/project-migration
View github-team.py
#!/usr/bin/python
# Exports a CSV of repo names, readme files, and the license of the project.
from __future__ import print_function
import requests
import json
import settings
from urlparse import urlparse, parse_qs
import sys
View nrpe_setup.md

Install NRPE and the necessary plugins.

CentOS/Fedora/RHEL

sudo yum install nrpe nagios-plugins nagios-plugins-all

Ubuntu/Debian

sudo apt-get install nagios-nrpe-server nagios-plugins

@krusynth
krusynth / list.blade.php
Last active Aug 22, 2017
Hack to use Ajax to rehash all mods in Technic Solder. Replaces app/views/mod/list.blade.php
View list.blade.php
@extends('layouts/master')
@section('title')
<title>Mod Library - TechnicSolder</title>
@stop
@section('content')
<div class="page-header">
<h1>Mod Library</h1>
</div>
<div class="panel panel-default">
<div class="panel-heading">
@krusynth
krusynth / gorky.txt
Created Aug 17, 2015
Maxim Gorky's Reminiscences of Leo Tolstoy
View gorky.txt
"You hammer away like a parrot at one word, freedom, freedom; but what is the sense of it? If you attained your freedom, what do you imagine would happen? In the philosophic sense, a bottomless void, and in actual life you would become an idler, a parasite. If you were free in your sense, what would bind you to life or to people? Now, birds are free, but still they build nests; you, however, wouldn't even build a nest, but would gratify your sexual feeling anywhere, like a dog. You think seriously, and you will come to see, you will come to feel, that this freedom is ultimately emptiness, boundlessness... Christ was free and so was Buddha, and both took on themselves the sins of the world and voluntarily entered the prison of earthly life. Further than that nobody has gone, nobody. And you—we—well, what's the good of talking—we are all looking for freedom from obligations towards our fellow men, whereas it is just that feeling of our obligations which has made us men, and, if those obligations were not there,
View MM_reloadpage.js
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
@krusynth
krusynth / example.php
Created Jun 7, 2015
Use Wordpress login system on a custom PHP page.
View example.php
/**
* Example of php code using Wordpress' login.
*/
require_once '../pages/wp-blog-header.php';
// If the user is not authorized, redirect to the Wordpress login.
auth_redirect();
// Your code here
View Solr init script
#!/bin/bash
#
# solr APACHE SOLR 4.10
#
# chkconfig: 2345 85 15
# description: Startup Script for APACHE SOLR 4.10
#
# processname: solr
@krusynth
krusynth / date-query.txt
Created May 12, 2015
Handling multifield dates. Please don't do this. It's bad - unmanageable, unreadable.
View date-query.txt
mysql> desc testdates;
+-------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| year | smallint(5) unsigned | YES | | NULL | |
| month | tinyint(3) unsigned | YES | | NULL | |
| day | tinyint(3) unsigned | YES | | NULL | |
+-------+----------------------+------+-----+---------+----------------+
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@krusynth
krusynth / indexSpec.js
Created Jan 21, 2015
Example using Squire for Dependency injection.
View indexSpec.js
define(['squire'], function (Squire) {
"use strict";
describe("DashboardIndexController", function () {
var context = {};
var ready = false;
beforeEach(function () {
runs(function () {
context.injector = new Squire();