Skip to content

Instantly share code, notes, and snippets.

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

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
@gocs
gocs / setup.md
Last active October 28, 2022 00:01
Linux setups after initial os boot

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
#!/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

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`
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

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

@gocs
gocs / glyph_test.sh
Created June 27, 2022 06:22
enable UTF-8 support in the Linux console?
#!/bin/sh
# https://unix.stackexchange.com/a/303713
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
printf '\033%%@'
else
printf '\033%%G'
fi
@gocs
gocs / golang raspi.md
Last active April 24, 2023 05:41
golang for raspi 4 model b

question

what release should I use for my raspberry pi 4 model b?

$ uname -m
arm7l

or