Skip to content

Instantly share code, notes, and snippets.

Jesse Dearing jessedearing

Block or report user

Report or block jessedearing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View analyze.go
package main
import (
"database/sql"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"sync"
View file_block.rb
File.open(‘hello.txt’, ‘r’) do |f|
while line = f.gets
puts line
end
end
View FileTryResource.java
try(FileInputStream input = new FileInputStream(“file.txt”)) {
int data = input.read();
while(data != -1) {
System.out.print((char) data);
data = input.read();
}
}
View typical_defer.go
connection, err := net.Dial("tcp", "example.com:80")
if err != nil {
// Do something to handle the error
return
}
defer connection.Close()
View ssh_and_find_process.go
sshClient, err := setUpSSHClient(host)
if err != nil {
log.Panic(err)
}
defer sshClient.Close()
lsofOut, err := runCmd(sshClient, "sudo lsof -i tcp:"+port+" | tail -1 | awk '{ print $2; }'")
lsofOut = strings.Trim(lsofOut, "\n\r ")
if err != nil {
log.Panic(err)
View capture_host_port.go
db, err := sql.Open("mysql", user+":"+password+"@tcp("+host+":3306)/information_schema")
if err != nil {
log.Fatal(err)
}
defer db.Close()
hostWithPort := getHost(db)
if hostWithPort == nil {
log.Println("Could not find query with that ID")
return
View keybase.md

Keybase proof

I hereby claim:

  • I am jessedearing on github.
  • I am jessed (https://keybase.io/jessed) on keybase.
  • I have a public key ASDHcM5dilzf0pRTuwAcQfzaPVtA7X4eT_hnyRk8ztRYcgo

To claim this, I am signing this object:

View rep.go
package main
import (
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
)
@jessedearing
jessedearing / mysql.go
Last active Aug 2, 2016
Use the MySQL driver to establish connections in Golang
View mysql.go
package main
import (
"fmt"
"log"
"database/sql/driver"
"github.com/go-sql-driver/mysql"
)
@jessedearing
jessedearing / 0-README.md
Last active Nov 13, 2019
@sadserver's tweets in fortune file format
View 0-README.md

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.
You can’t perform that action at this time.