Skip to content

Instantly share code, notes, and snippets.

View atc0005's full-sized avatar

Adam Chalkley atc0005

View GitHub Profile
package main
import (
"fmt"
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
"net/url"
)
@atc0005
atc0005 / http_get.go
Created June 30, 2023 21:08 — forked from mobleyc/http_get.go
Creating a custom HTTP Transport and Client with Go
package main
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"time"
)
@atc0005
atc0005 / unique elements in a slice
Created June 23, 2023 12:10 — forked from johnwesonga/unique elements in a slice
Go code that ensures elements in a slice are unique
package main
import "fmt"
func uniqueNonEmptyElementsOf(s []string) []string {
unique := make(map[string]bool, len(s))
us := make([]string, len(unique))
for _, elem := range s {
if len(elem) != 0 {
if !unique[elem] {
@atc0005
atc0005 / local-ruby-gem.md
Created November 17, 2022 22:31 — forked from zulhfreelancer/local-ruby-gem.md
How to use a local Ruby gem in Rails project?

Situation

You are working on a Rails app that uses a gem named abc. This gem is hosted on RubyGems and the source code of the gem is available at https://github.com/your-username/abc.

You created a new branch locally for your gem (new-feature). You wanted to modify the gem and load it directly to your local Rails app. And, you don't want to push the gem changes to GitHub and publish the gem to RubyGems just yet.

You want all the changes that you made in your local gem directory get reflected immediately in your local Rails app without requiring you to run gem build and gem install command in the gem's local directory.

Steps

@atc0005
atc0005 / main.go
Created August 29, 2022 16:14 — forked from andrewsomething/main.go
Report download statistics for GitHub release assets
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"os"
"strings"
"text/tabwriter"
@atc0005
atc0005 / main.go
Created July 26, 2022 20:25 — forked from StarBuckR/main.go
Golang Ldap Authentication, Bind and Search, including Anonymous Bind
package main
import (
"fmt"
"log"
"github.com/go-ldap/ldap/v3"
)
const (
@atc0005
atc0005 / openssl_commands.md
Created February 16, 2022 22:42 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@atc0005
atc0005 / matching-lines.go
Last active October 19, 2023 19:07
Python & Go | Check if lines in one file are in another file
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
@atc0005
atc0005 / for-the-love-of-go-epub-test-results.md
Created December 17, 2020 10:43
epubcheck v4.2.4 results against "For The Love of Go" ebooks

epubcheck v4.2.4 results against "For The Love of Go" ebooks

For The Love of Go - Data.epub

$ java -jar epubcheck.jar For\ The\ Love\ of\ Go\ -\ Data.epub
Validating using EPUB version 3.2 rules.
ERROR(RSC-007): For The Love of Go - Data.epub/EPUB/styles/stylesheet1.css(8,3): Referenced resource "EPUB/styles/fonts/SourceSerifPro-Regular.ttf" could not be found in the EPUB.
ERROR(RSC-007): For The Love of Go - Data.epub/EPUB/styles/stylesheet1.css(19,3): Referenced resource "EPUB/styles/fonts/RobotoSlab-VariableFont_wght.ttf" could not be found in the EPUB.
@atc0005
atc0005 / curl_post_json.md
Created April 8, 2020 15:35 — forked from ungoldman/curl_post_json.md
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example: