Skip to content

Instantly share code, notes, and snippets.

View unstppbl's full-sized avatar
🐯

unstppbl

🐯
View GitHub Profile
@unstppbl
unstppbl / sleep.js
Last active December 25, 2017 06:20
Synchronous and asynchronous python-like sleep function
// Sycnhronous python-like sleep function
const sleep = (ms) => {
const start = new Date().getTime();
const expire = start + ms;
while (new Date().getTime() < expire) {
// spinning...
}
};
// Asynchronous sleep
@unstppbl
unstppbl / cleaner.go
Created September 8, 2018 06:33
Script to clear Yara rules (remove duplicates, move files with syntax errors, etc.)
package main
import (
"bufio"
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@unstppbl
unstppbl / emailExtract.go
Created October 30, 2018 09:13
Script to extract unique emails from file, assuming there is only one per line
package main
import (
"bufio"
"os"
"regexp"
)
func checkErr(err error) {
if err != nil {
@unstppbl
unstppbl / formatter.go
Created February 25, 2019 10:39
Basic text files formatter
package main
import (
"bufio"
"log"
"os"
"strings"
)
func checkErr(err error) {
@unstppbl
unstppbl / netstat.sh
Created October 25, 2019 18:22
shell command to print tcp connections status
while true; do netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n; sleep 1; clear; done

Keybase proof

I hereby claim:

  • I am unstppbl on github.
  • I am unstppbl (https://keybase.io/unstppbl) on keybase.
  • I have a public key ASAJVwJ_h7cEOGQQ1jgb3IML0juqUSulxsn0_z-WXjsjXgo

To claim this, I am signing this object:

@unstppbl
unstppbl / struct.go
Created January 22, 2020 09:52
Helpers to convert from pb.Struct to map[string]interface
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@unstppbl
unstppbl / go_time_parsing.md
Last active May 7, 2024 22:06
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@unstppbl
unstppbl / kubectl.sh
Created March 24, 2020 12:55
Kubectl cmds
# list all pods
kubectl -n dev get pods
# list all config maps (CM) for env vars etc.
kubectl -n dev get cm
# get logs of pod
kubectl -n dev logs -f <pod name>
# get content of CM
@unstppbl
unstppbl / snx_instruction.md
Last active August 15, 2021 13:54
Fedora 34 snx installation