Skip to content

Instantly share code, notes, and snippets.

Avatar
defer/ mañana

gocs gocs

defer/ mañana
View GitHub Profile
@gocs
gocs / .sh
Created March 24, 2023 06:56
new golang mod for open source
View .sh
go mod init $(git remote -v | head -n 1 | sed -E 's/.*:([^\.]+)\..*/\1/' | awk '{print "github.com/"$1}')
@gocs
gocs / WRONGPASS.md
Last active March 6, 2023 01:34
if you have "WRONGPASS invalid username-password pair" error
View WRONGPASS.md

one cause is if you have quotes on your .env file

REDIS_PASSWORD="1_secret_password"

remove the quotes

REDIS_PASSWORD=1_secret_password
@gocs
gocs / angular_swal.md
Created February 8, 2023 13:37
ng-sweetalert2 as simple as alert
View angular_swal.md

simple SwalPortalDirective

The following example demonstrates a simple Swal with a button. In this example, you could provide more HTML within your HTML component rather than binding the HTML to an [html]. You would still need to import the SwalPortalTargets in your component.

import { SwalPortalTargets } from '@sweetalert2/ngx-sweetalert2';
export class MyComponent {
 public constructor(public readonly swal_targets: SwalPortalTargets) { }
@gocs
gocs / .md
Last active November 1, 2022 16:12
dayz deer isle alcatraz trap
View .md
@gocs
gocs / setup.md
Last active October 28, 2022 00:01
Linux setups after initial os boot
View setup.md

update os (DO THIS FIRST)

sudo apt update
sudo apt upgrade -y

enable password authentication for ssh

@gocs
gocs / icann-tld.sh
Created July 29, 2022 03:18
print for available tlds
View icann-tld.sh
#!/usr/bin/env bash
curl -SsfL https://data.iana.org/TLD/tlds-alpha-by-domain.txt | sed '/^#/d' - | awk '{print tolower($0)}'
@gocs
gocs / .md
Created July 19, 2022 11:42
golang time.Time zero value
View .md

What should be the time.Time's zero value?

It should be time.Now()

@gocs
gocs / baud.go
Last active July 19, 2022 06:06
why does usb serial prints unreadable �? identify your usb's BAUD `stty -F /dev/ttyUSB0`
View baud.go
package main
import (
"bufio"
"fmt"
"github.com/tarm/serial"
)
func main() {
@gocs
gocs / README.md
Last active July 17, 2022 02:53
signal cancel and timeout on an infinite loop go golang
View README.md

golang program to gracefully terminate on SIGTERM signal or timeout in a loop

ctrl + c gracefully terminates the app using the current terminal

terminate app from different terminal

the program output its pid