Skip to content

Instantly share code, notes, and snippets.

View emailnjv's full-sized avatar

Nicholas Vincent emailnjv

  • New Jersey
View GitHub Profile
@justincase
justincase / gist:5469009
Created April 26, 2013 17:45
Print struct with field names and values. From http://blog.golang.org/2011/09/laws-of-reflection.html
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
@shoreline-chrism
shoreline-chrism / wordpress-search-replace.sql
Created December 10, 2014 20:53
Update URLs in WP database with SQL Query
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
package main
import (
"fmt"
"golang.org/x/crypto/ripemd160"
)
func main() {
hasher := ripemd160.New()
hasher.Write([]byte("The quick brown fox jumps over the lazy dog"))
@meirbon
meirbon / Dell XPS 15 9560 Manjaro Setup instructions
Last active May 13, 2024 02:39
Small, quick guide to set up Manjaro on the XPS 15 9560
# 1. First of all of course get Manjaro:
https://manjaro.org/get-manjaro/
# I recommend using Etcher to copy the image to your USB:
https://etcher.io/
# 2. Before installing make sure:
# - Secure boot is disabled in BIOS
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much
@spkellydev
spkellydev / FAQ.class.php
Last active March 28, 2018 16:32
FAQ schema class
<?php
class FAQ
{
public $html = '';
function __construct ( )
{
add_shortcode( 'sl9-faq', array( $this, 'shortcode' ) );
}
@anvinjain
anvinjain / bytes_arr_test.go
Created July 4, 2018 05:53
Golang Byte Array creation: append vs bytes.Join Benchmark
package main
import (
"testing"
"bytes"
)
func TestBytesAppendIsEquivalentToJoin(t *testing.T) {
prefix := []byte("announce")
sep := "/"