Skip to content

Instantly share code, notes, and snippets.

@atomlab
atomlab / pubkey_to_addr.go
Created May 8, 2020 13:05 — forked from davecgh/pubkey_to_addr.go
Example of converting a raw public key to a btcutil.Address.
package main
import (
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
)
func main() {
@atomlab
atomlab / clean_prometheus_data.md
Last active February 18, 2024 08:56
Delete data from Prometheus

starting the server with the option

--web.enable-admin-api

Prometheus

# delete alerts series
curl -v -X POST -g 'http://localhost:9090/api/v2/admin/tsdb/delete_series?match[]=ALERTS'
@atomlab
atomlab / config.md
Created March 17, 2020 22:50
How can I match a CIDR range for an SSH config host entry?
all hosts matching 10.2.?.* (i.e. 10.2.0.0–10.2.9.255)
all hosts matching 10.2.??.* (i.e. 10.2.10.0–10.2.99.255)
all hosts matching 10.2.10?.* (i.e. 10.2.100.0–10.2.109.255)
all hosts matching 10.2.11?.* (i.e. 10.2.110.0–10.2.119.255)
all hosts matching 10.2.12?.* EXCEPT the ones matching 10.2.128.* and 10.12.129.* (and remember that the exclusion must come first!)

Example ~/.ssh/config

@atomlab
atomlab / forbidden-12-index-read-only-allow-delete-api.md
Last active March 9, 2020 12:04
[ELASTIC] FORBIDDEN/12/index read-only / allow delete (api)]
PUT _settings
    {
    "index": {
    "blocks": {
    "read_only_allow_delete": "false"
    }
    }
    }
@atomlab
atomlab / malicious_software.md
Created February 29, 2020 17:36
"Can’t be opened because Apple cannot check it for malicious software"
sudo spctl --master-disable
@atomlab
atomlab / show_top_memory_usage_proc.md
Last active February 27, 2020 11:45
How to Find Out Top Memory Consuming Processes in Linux

ps

# ps aux --sort -rss | head

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mysql     1064  3.2  5.4 886076 209988 ?       Ssl  Oct25  62:40 /usr/sbin/mysqld
varnish  23396  0.0  2.9 286492 115616 ?       SLl  Oct25   0:42 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :82 -T 127.0.0.1:6082 -S /etc/varnish/secret -s malloc,256M
named     1105  0.0  2.7 311712 108204 ?       Ssl  Oct25   0:16 /usr/sbin/named -u named -c /etc/named.conf
nobody   23377  0.2  2.3 153096 89432 ?        S    Oct25   4:35 nginx: worker process
@atomlab
atomlab / cred.groovy
Created January 31, 2020 11:44
Jenkins job DSL scripts examples
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
def credStore(credentials_id) {
def cred_list = [:]
credentials_store = jenkins.model.Jenkins.instance.getExtensionList(
'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)
credentials_store[0].credentials.each { it ->
if (it.id == credentials_id) {
@atomlab
atomlab / tshark_examples.md
Last active January 25, 2020 08:45
Tshark Examples

Example 1

Method: POST
Port: 17076
interface: lo

tshark -i lo -Y "http.request.method == POST" -f 'dst port 17076' -T fields -e frame.time -e http.file_data

output

go get -u `go list -f '{{ join .Imports "\n" }}' api.go`