Skip to content

Instantly share code, notes, and snippets.

View frezbo's full-sized avatar
🏠
Working from home

Noel Georgi frezbo

🏠
Working from home
View GitHub Profile
@frezbo
frezbo / awk_netstat.sh
Created March 3, 2021 21:04 — 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){
@frezbo
frezbo / syncrepos.sh
Created June 16, 2020 18:48 — forked from brianredbeard/syncrepos.sh
Reposync - A better tool than mrepo. Use this to sync down all channels a RHEL system is subscribed to and turn them into locally exposed yum repositories.
#!/bin/bash
# This tool can be used to sync down Red Hat based packages from RHN using only Red Hat shipped tools
# Brian "Red Beard" Harrington <brian@dead-city.org>
# To satisfy the pre-reqs for this script install the following two rpms:
# yum-utils
# createrepo
download_dir="/var/www/html/RHN"
/usr/bin/reposync --gpgcheck -m --download-metadata -l -p ${download_dir}/ >> /var/log/reposync.log 2>&1
#!/usr/bin/env ruby
require 'base64'
require 'digest'
require 'openssl'
# Author: @thesubtlety
# Decrypts Jenkins 2 encrypted strings, code change introduced around Jenkins ver 2.44
# Based off work by juyeong, https://gist.github.com/juyeong/081379bd1ddb3754ed51ab8b8e535f7c
@frezbo
frezbo / RBAC_Grants.groovy
Created June 14, 2019 06:14 — forked from chromko/RBAC_Grants.groovy
Add Jenkins RBAC roles and assign them
import hudson.model.*
import hudson.security.*
import jenkins.*
import jenkins.model.*
import java.util.*
import com.michelin.cio.hudson.plugins.rolestrategy.*
import java.lang.reflect.*
RoleBasedAuthorizationStrategy roleBasedAuthenticationStrategy = Hudson.instance.getAuthorizationStrategy()
@frezbo
frezbo / md4.rb
Created December 12, 2018 19:06 — forked from tprynn/md4.rb
Ruby md4 implementation
def md4(string)
# functions
mask = (1 << 32) - 1
f = proc {|x, y, z| x & y | x.^(mask) & z}
g = proc {|x, y, z| x & y | x & z | y & z}
h = proc {|x, y, z| x ^ y ^ z}
r = proc {|v, s| (v << s).&(mask) | (v.&(mask) >> (32 - s))}
# initial hash
a, b, c, d = 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
@frezbo
frezbo / 1-setup.md
Created November 23, 2018 08:43 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

@frezbo
frezbo / SetBuildEnvVars.groovy
Created August 21, 2018 11:28 — forked from alces/SetBuildEnvVars.groovy
Set environment variables during a Jenkins build using Groovy
// should be run as Groovy System Script
import hudson.EnvVars
import hudson.model.Environment
def build = Thread.currentThread().executable
def vars = [ENV_VAR1: 'value1', ENV_VAR2: 'value2']
build.environments.add(0, Environment.create(new EnvVars(vars)))
@frezbo
frezbo / papers.md
Created July 30, 2018 04:59 — forked from jhertz/papers.md
Security Papers I Like

In absolutely no order

@frezbo
frezbo / jessfraz.md
Created July 30, 2018 04:59 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.