Skip to content

Instantly share code, notes, and snippets.

View Adron's full-sized avatar
🤘
GSD. Just ping me, I'll get back at ya.

Adron Hall Adron

🤘
GSD. Just ping me, I'll get back at ya.
View GitHub Profile
@Adron
Adron / disable-hyper-v.ps1
Created February 4, 2019 17:21
Disabling/Enabling Hyper-V via Powershell ("Run As Administrator")
# Remember, all of these commands need executed via Powershell that is started/opened with "Run As Administrator".
# Disabling Hyper-V
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
# Enabling Hyper-V
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@Adron
Adron / main.go
Created January 29, 2019 22:08
Duplicate line finder in Go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
counts := make(map[string]int)
@Adron
Adron / bashParams.sh
Created December 28, 2018 08:21
Getting Bash Parameters
echo "The first parameter $1"
echo "The second parameter is $2"
echo "The \$0 parametere returns the name of the file! This file is named $0."
@Adron
Adron / Findem.go
Created December 28, 2018 00:00
Findem Functionality for looking up a list of Twitter Accounts via the Twitter API for the Twitz app.
var findemCmd = &cobra.Command{
Use: "findem",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
@Adron
Adron / GetBearerToken.go
Created December 27, 2018 23:49
Get Bearer Token Function for go-twitter
func getBearerToken(consumerKey, consumerSecret string) (string, error) {
req, err := http.NewRequest("POST", "https://api.twitter.com/oauth2/token",
strings.NewReader("grant_type=client_credentials"))
if err != nil {
return "", fmt.Errorf("cannot create /token request: %+v", err)
}
b64Token := base64.StdEncoding.EncodeToString(
[]byte(fmt.Sprintf("%s:%s", consumerKey, consumerSecret)))
@Adron
Adron / buildTwitterListFunction.go
Created December 27, 2018 23:45
Build Twitter List Function
func buildTwitterList() []string {
theFile := viper.GetString("file")
theTwitterers, err := ioutil.ReadFile(theFile)
check(err)
stringTwitterers := string(theTwitterers[:])
splitFields := strings.Fields(stringTwitterers)
var completedTwittererList []string
for _, aField := range splitFields {
if strings.HasPrefix(aField, "@") && aField != "@" {
reg, _ := regexp.Compile("[^a-zA-Z0-9_@]")
@Adron
Adron / parse.go
Created December 27, 2018 23:39
The parse function in the twitz app.
var parseCmd = &cobra.Command{
Use: "parse",
Short: "This command will extract the Twitter Accounts form a text file.",
Long: `This command will extract the Twitter Accounts and clean up or disregard other characters
or text around the twitter accounts to create a simple, clean, Twitter Accounts only list.`,
Run: func(cmd *cobra.Command, args []string) {
completedTwittererList := buildTwitterList()
fmt.Println(completedTwittererList)
if viper.Get("fileExport") != nil {
exportParsedTwitterList(viper.GetString("fileExport"), viper.GetString("fileFormat"), completedTwittererList)
@Adron
Adron / config.go
Created December 27, 2018 23:37
The main code for the config functionality file for twitz.
var configCmd = &cobra.Command{
Use: "config",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For the custom example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Twitterers File: %s\n", viper.GetString("file"))
@Adron
Adron / reactStuff.js
Created December 27, 2018 06:43
React stuffs.
class ShoppingList extends React.Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for {this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
@Adron
Adron / DatHello.vue
Created December 27, 2018 06:41
Hello world for Vue.js!
<script src="https://unpkg.com/vue"></script>
<div id="app">
<p id="hello">{{ message }} hi!</p>
</div>
<script>
new Vue({
el: '#app',
data: {