Skip to content

Instantly share code, notes, and snippets.

View umamiMike's full-sized avatar

Michael W.C. Wilding umamiMike

View GitHub Profile
#!/bin/bash
# fun script I made in an hour to play with demoing various commands.
# Should be filed under stupid-bash-tricks
clear
echoEval () {
echo -e " ========================================="
cmd=$*
echo -e "Evaluation the command :\n \t\t $cmd \n =============================="
package main
import "fmt"
import "reflect"
var fp = fmt.Println
func main() {
methodExpressionPlay2()
@umamiMike
umamiMike / google script to write from spreadsheet to calendar
Last active March 4, 2020 22:19
google script to write from spreadsheet to calendar
function logProductInfo() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
// var today = new Date();
var today = data[0][7];
var events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
events.forEach(function(e){
@umamiMike
umamiMike / csvToAjaxCall.go
Last active November 22, 2017 23:27
WIP make a batch series of ajax calls from a csv with the keys of the data as the headers of the first row
package main
import (
"encoding/json"
"fmt"
// "github.com/davecgh/go-spew/spew"
"github.com/recursionpharma/go-csv-map"
"io/ioutil"
"net/http"
"net/url"
@umamiMike
umamiMike / gitdiff
Created October 24, 2017 20:42
gitdiff filelist
#!/bin/bash
# usage: gitdiff {another branch}
# will show the files which are different between the branch you are currently on
# and the other branch
# I use it to remind myself which files I have been editing
# TODO: pump it into quickfix in vim
while getopts ":h:" opt; do
case ${opt} in
h)
@umamiMike
umamiMike / gitRemoveTarFile.sh
Last active March 8, 2016 04:07
Remove a file from git history
!#/bin/bash
#will remove the file and all traces of it from your git history.
# Good for removing the accidental large bin file
# or maybe some sensitive data you accidentally committed
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch THEFILENAME HERE' --prune-empty --tag-name-filter cat -- --all

Basics

to get all possible unique values in the rows of table

SELECT DISTINCT column_name FROM Table name

Import a sql file

mysql -h yourhostname -u username -p databasename < yoursqlfile.sql

Create a user

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';