Skip to content

Instantly share code, notes, and snippets.

View thrix's full-sized avatar

Miroslav Vadkerti thrix

View GitHub Profile
@thrix
thrix / axios-catch-error.js
Created March 4, 2019 06:47 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
axios.put(this.apiBaseEndpoint + '/' + id, input)
.then((response) => {
// Success
})
.catch((error) => {
// Error
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
// console.log(error.response.data);
@thrix
thrix / koji-api
Created March 27, 2019 09:57 — forked from amitsaha/koji-api
Koji API
_listapi()
addExternalRPM(rpminfo, external_repo, strict=True)
description: Import an external RPM
This call is mainly for testing. Normal access will be through
a host call
addExternalRepoToTag(tag_info, repo_info, priority)
description: Add an external repo to a tag
addGroupMember(group, user, strict=True)
description: Add user to group
@thrix
thrix / awk_netstat.sh
Created February 10, 2020 10:58 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){