Skip to content

Instantly share code, notes, and snippets.

View jessedearing's full-sized avatar

Jesse Dearing jessedearing

View GitHub Profile
package main
import (
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
)
@jessedearing
jessedearing / mysql.go
Last active August 2, 2016 22:19
Use the MySQL driver to establish connections in Golang
package main
import (
"fmt"
"log"
"database/sql/driver"
"github.com/go-sql-driver/mysql"
)
@jessedearing
jessedearing / 0-README.md
Last active November 14, 2023 15:02
@sadserver's tweets in fortune file format

Description

This is all of @sadserver's tweets packaged in a file ready to be converted into a .dat file for the fortune program.

Installing

  1. Install fortune if your distro doesn't already have it.
  2. Convert this into a fortune file run strfile -c % sadserver_tweets sadserver_tweets.dat
  3. Copy the files into your fortune directory cp sadserver_tweets sadserver_tweets.dat /usr/local/share/games/fortunes. Note that I'm on OS X so the file path reflects that. Linux is going to be something like /usr/share/games/fortunes.
  4. Add a line to your shell's profile/rc file. I.e. fortune sadserver_tweets
  5. Laugh/cry when you log into your desktop/servers.
# Install
install.packages("RMySQL")
# Load MySQL
library(RMySQL)
#Connect
con <- dbConnect(MySQL(), dbname="thedb", host="mysqldb")
#Query

Quick Reference

Mysql

Change Master

  change master to
  MASTER_HOST='',
  MASTER_PORT=3306,
  MASTER_USER='',
  MASTER_PASSWORD='',
  MASTER_LOG_FILE='',
  MASTER_LOG_POS=

#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@jessedearing
jessedearing / boot2docker_init.sh
Last active August 29, 2015 13:58
My boot2docker init adding port forwarding for all the cool services I use
#!/usr/bin/env sh
if ! which boot2docker; then
brew install boot2docker
mkdir $HOME/.boot2docker
echo DOCKER_PORT=32000 > $HOME/.boot2docker/profile
fi
if [[ -z $DOCKER_HOST ]]; then
export DOCKER_HOST="tcp://127.0.0.1:32000"
add_to_shell=1
select * from catalogs where hash in (select catalog from certname_catalogs, certnames where certnames.name = certname_catalogs.certname and certnames.deactivated is not null);
@jessedearing
jessedearing / gist:6058087
Last active December 20, 2015 02:39
Vol Group Cheatsheet

Display volume group

vgdisplay

Rescan SCSI

echo "- - -" > /sys/class/scsi_host/host0/scan

Create volume

pvcreate /dev/sdd

Extend volume

#!/bin/bash
# myapp daemon
# chkconfig: 345 20 80
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/home/jdearing/projects/myapp"
DAEMON=myapp
DAEMONOPTS="-my opts"