Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Bishop porjo

  • Australia
View GitHub Profile
@porjo
porjo / phpredis_pecl_centos6.md
Last active Feb 6, 2020
how to install phpredis on Centos6 using pecl
View phpredis_pecl_centos6.md

How to install phpredis extension on Centos6 using pecl:

# Enable EPEL repository
yum install epel-release

# Install Autoconf v2.68
yum install autoconf268

# Install the extension
@porjo
porjo / citrix_fedora.md
Last active Jan 14, 2020
Install Citrix ICA client on Fedora
View citrix_fedora.md

Running Citrix ICA client on Fedora

  • Download 'Receiver for Linux Web client (x86_64)' from Citrix website
  • Install package e.g.dnf install ICAClientWeb-rhel-13.10.0.20-0.x86_64.rpm
  • Install dependencies (not sure if all these are required):
sudo dnf install compat-openssl10 motif libXaw libidn1.34 libjpeg-turbo-utils
  • Modify launcher /usr/share/applications/wfica.desktop:
@porjo
porjo / ssl_CN_lookup_by_IP.sh
Created Dec 6, 2019
Given a list of IP addresses (in file 'ips') find what the SSL CN (subject) is for each one.
View ssl_CN_lookup_by_IP.sh
#!/bin/bash
# Given a list of IP addresses (in file 'ips') find what the SSL CN (subject) is for each one.
echo -en "IP\tSSL CN\n"
for i in `cat ips`; do
echo -en "$i\t"
out=`timeout 2 bash -c "openssl s_client -showcerts -connect $i:443 < /dev/null 2> /dev/null | openssl x509 -noout -subject 2> /dev/null | grep 'subject=' | sed -rn 's/.*CN=([^ /]+).*/\1/p'"`
if [ $? -eq 124 ]; then
echo "(timeout)"
@porjo
porjo / aws_sign_v4.php
Created Apr 16, 2019
PHP function to generate curl headers suitable for signed requests agains AWS API
View aws_sign_v4.php
// Sign the request and return header array for use by curl
//
// For HTTP methods with no payload (GET,DELETE) leave $Payload , $ContentType empty
//
// Based on: http://usefulangle.com/post/34/aws-s3-upload-api-php-curl
private function SignRequest($Method, $URL, $Payload='', $ContentType='')
{
if(!defined('AWS_ACCESS_KEY_ID') || !defined('AWS_SECRET_ACCESS_KEY') || !defined('AWS_REGION'))
return null;
@porjo
porjo / random_ip.go
Created Feb 11, 2019
Generate random IPs with Go
View random_ip.go
package main
import (
"encoding/binary"
"fmt"
"math/rand"
"net"
)
func main() {
@porjo
porjo / exetel.15m+.sh
Created Dec 24, 2018
Argos / Bitbar shell script for fetching Exetel usage stats
View exetel.15m+.sh
#!/usr/bin/env bash
echo "Exetel"
echo "---"
USERNAME="076543210"
PASSWORD="xxxxx"
MinAge=5
COOKIE="/tmp/exetel.cookies"
JSON="/tmp/exetel.json"
@porjo
porjo / elb_compare.sh
Last active Nov 13, 2018
Compare AWS ELB response times
View elb_compare.sh
#!/bin/bash
# compare AWS ELB: CLB (classic) and ALB (application) response times
# all output times are in seconds
CLB_URL="https://clb.example.com"
ALB_URL="https://alb.example.com"
clb_wins=0
alb_wins=0
@porjo
porjo / pulseaudio_rtp.md
Last active Sep 1, 2020
Use Pulseaudio to stream audio file to network via RTP
View pulseaudio_rtp.md

RTP Server

Setup

pacmd load-module module-null-sink sink_name=rtp format=s16le channels=1 rate=16000
pacmd load-module module-rtp-send source=rtp.monitor

This sets up a multicast socket for RTP streams. When I tested this was 224.0.0.56:46136

@porjo
porjo / httpGetMux.go
Last active Aug 4, 2018
GET a HTTP resource using multiple goroutines and mux the result into an output file
View httpGetMux.go
package main
import (
"bufio"
"flag"
"fmt"
"io"
"net/http"
"os"
"strconv"
@porjo
porjo / retext.css
Last active Aug 13, 2018 — forked from elclanrs/retext.css
Markdown theme for ReText
View retext.css
body {
color: #333;
font-family: Arial, sans-serif;
max-width: 7.5in;
margin: 0 auto;
}
a:link, a:visited {
color: #1B70D1;
text-decoration: none;
You can’t perform that action at this time.