Skip to content

Instantly share code, notes, and snippets.

View bombsimon's full-sized avatar
🍕

Simon Sawert bombsimon

🍕
View GitHub Profile
@bombsimon
bombsimon / 256-color.pl
Created January 13, 2018 19:47
Script to check terminal color support
#!/usr/bin/env perl
use warnings;
use strict;
foreach my $red ( 0..5 ) {
foreach my $green ( 0..5 ) {
foreach my $blue ( 0..5 ) {
printf(
"\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
@bombsimon
bombsimon / multicert.py
Created February 8, 2018 19:25
Read multiple certificates from one file
import OpenSSL.crypto
def main():
cert_file = '/Users/Simon/combined.pem'
certificates = {}
certificate_id = 0
with open(cert_file, 'r') as f:
for line in f:
@bombsimon
bombsimon / disable-ssh.sh
Last active September 8, 2019 21:16
Disable SSH login
#!/bin/bash
set -e
# Set a default port
SSH_PORT=${1:-998}
# Disable password login
sudo sed -i "/PasswordAuthentication/s/yes/no/g" /etc/ssh/sshd_config
@bombsimon
bombsimon / local-tmux.sh
Last active August 27, 2018 20:35
Install tmux locally
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.7
@bombsimon
bombsimon / cleanup-docker
Created August 12, 2018 15:28
Cleanup everything docker is leaving behind
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
if [[ -n $(docker ps -a -q -f status=exited) ]]; then
docker rm $(docker ps -a -q -f status=exited)
fi
#!/usr/bin/env perl
use ExtUtils::Installed;
use warnings;
use strict;
use feature qw( say );
my $inst = ExtUtils::Installed->new();
foreach my $module ( $inst->modules ) {
#!/bin/bash
sudo yum groups install -y Development\ tools
sudo yum install -y cmake python36-{devel,pip}
sudo pip-3.6 install neovim --upgrade
(
cd $HOME
tmpdir="$(mktemp -d)"
cd $tmpdir
git clone https://github.com/neovim/neovim.git
@bombsimon
bombsimon / perl-macos.md
Last active September 12, 2019 19:09
Perl package require special handling

CPAN modules and macOS

Image::Magick

# Install version 6 of imagemagick to comply with Magick.xs
brew install imagemagick@6 --with-perl

# Create links so make can find C libraries.
# imagemagick@6 is keg-only and must be linked with --force
@bombsimon
bombsimon / anagram
Created March 5, 2019 11:57
Just another Perl hacker and other obfuscations
$_ = "wftedskaebjgdpjgidbsmnjgc";
tr/a-z/oh, turtleneck Phrase Jar!/; print;
@bombsimon
bombsimon / certificates.go
Last active April 25, 2019 13:55
Working with certificates in Go
package main
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/pem"