Skip to content

Instantly share code, notes, and snippets.

View Mattlk13's full-sized avatar

Matthew Krebs Mattlk13

  • All Your Computer Solutions
  • Belton, Mo
View GitHub Profile
We couldn’t find that file to show.
@Mattlk13
Mattlk13 / jekyll-import.php
Created February 15, 2017 05:28 — forked from songzhou21/jekyll-import.php
Import a Jekyll posts directory into WordPress
<?PHP
require '/path/to/markdown-extra.php';
$db = mysql_connect('localhost', 'root', 'password') or die(mysql_error());
mysql_select_db('tylerio', $db) or die(mysql_error());
$files = scandir('posts');
array_shift($files); // .
array_shift($files); // ..
@Mattlk13
Mattlk13 / count.php
Created February 15, 2017 09:29 — forked from tylerhall/count.php
A quick PHP script to count the total number of words written in your Day One journal file.
<?PHP
$journal_fn = $argv[1];
$entries_dir = $journal_fn . '/entries/';
$entries = scandir($entries_dir);
print_r($entries);
$total_words = 0;
@Mattlk13
Mattlk13 / count.php
Created February 15, 2017 09:29 — forked from tylerhall/count.php
A quick PHP script to count the total number of words written in your Day One journal file.
<?PHP
$journal_fn = $argv[1];
$entries_dir = $journal_fn . '/entries/';
$entries = scandir($entries_dir);
print_r($entries);
$total_words = 0;
#requires -Modules Configuration, Pester, PSScriptAnalyzer
[CmdletBinding()]
[OutputType()]
$ErrorActionPreference = "Stop"
try {
# Setup environment.
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force |
@Mattlk13
Mattlk13 / reactor.ks
Created February 22, 2017 20:18 — forked from quill18/reactor.ks
// A Reactor Management Script by quill18 (http://quill18.com)
// Latest Version: https://gist.github.com/quill18/c4b71d81f9202db11455
//
//
// Developed for:
// Kerbal Space Program 1.04
// kOS 0.17.3
// Near Future Electrical 0.5.3
//
//
@Mattlk13
Mattlk13 / KafkaProducer.java
Created February 24, 2017 02:36 — forked from onesuper/KafkaProducer.java
Kafka producer, with Kafka-Client and Avro
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.Encoder;
import org.apache.avro.io.EncoderFactory;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@Mattlk13
Mattlk13 / KafkaProducer.java
Created February 24, 2017 02:36 — forked from yaroncon/KafkaProducer.java
Kafka producer, with Kafka-Client and Avro
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.Encoder;
import org.apache.avro.io.EncoderFactory;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
servers="server1 server2 server3"
for osdserver in ${servers} ; do
j=1
for disk in {a..p} ; do
echo ceph-deploy disk zap ${osdserver}:sd${disk}
echo ceph-deploy disk prepare ${osdserver}:sd${disk}:/dev/nvme0n1p${j}
echo ceph-deploy disk activate ${osdserver}:sd${disk}:/dev/nvmen1p${j}
let j=j+1
done
done
@Mattlk13
Mattlk13 / unzip.php
Created September 4, 2018 05:32 — forked from joseporiol/unzip.php
Unzip file
function unzip_file($file, $destination) {
// create object
$zip = new ZipArchive() ;
// open archive
if ($zip->open($file) !== TRUE) {
die ('Could not open archive');
}
// extract contents to destination directory
$zip->extractTo($destination);
// close archive