Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@bsodmike
bsodmike / easter_egg.rb
Created January 29, 2020 13:59
CircleCI email easter egg
input = %w(01101000 01101111 01110111 00100000 01110100 01101111 00100000 01100100 01100101 01100011 01100101 01101110 01110100 01110010 01100001 01101100 01101001 01111010 01100101 00100000 01110100 01110111 01101001 01110100 01110100 01100101 01110010)
n = input.map { |e| e.to_i(2).chr }
n = n.join
puts n
# =>
# how to decentralize twitter
@bsodmike
bsodmike / post.py
Last active January 15, 2019 16:40
Python example to POST some JSON
import requests
import json
url = 'http://localhost:2368/ghost/api/v0.1/posts'
payload = {
"posts": [{ "markdown": "<p>Some content goes here</p>", "title": "New", "status": "published"}]
}
headers = {
"Authorization": "Bearer 7CVoMaf68zd6jeWo9oz4syKvTyizrdDf5Uyv7vEAJHHwU8ceKoRcXw4tLw0V6m4z7MI3uXc4aI8iPFkPaTRGWXrKt4myAMJsK5YgWdDy8N26MqwNNxq2XC0bKOooU1hgyCJpfNecnBztRyXkFZUZUqbRFbkt4kBBYDhD6O7hJ7qzpSwjeX4E0JEvEU3R4ye"
@bsodmike
bsodmike / zfs-delete-snapshots.sh
Created May 20, 2018 01:42
FreeNAS ZFS delete snapshots retaining the last 'N' only.
#!/bin/bash
# Retain last 10 snapshots only.
set -e
zfs list -t snapshot -o name -S creation | grep ^big/media@auto | tail -n +10 | xargs -n 1 zfs destroy -vr
@bsodmike
bsodmike / iam-policy-change-user-password.json
Last active March 28, 2018 15:59
Useful AWS IAM Policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:ChangePassword"
],
"Resource": [
"arn:aws:iam::*:user/${aws:username}"
@bsodmike
bsodmike / docker-wipe.sh
Created March 27, 2018 04:08
Cronjob script to reset Docker (for running out of space) and Redeploying from AWS ECR
#!/bin/bash
# Copyright (c) 2018 Secure Cloud Solutions // securecloudsolutions.io
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#

Lessons for Life and Business, 19th February 2018

  • Separation of home and state.
  • If you work for me, you'll be my employee first. I'll treat you like family, until you stick that knife in my back.
@bsodmike
bsodmike / encrypt.rb
Last active February 4, 2018 09:28
POC Encryption in Ruby for Discussion at Level1 Techs
# Copyright (c) 2018 Michael de Silva, CTO Secure Cloud Solutions (siliconcloud.tech) & Inertialbox (inertialbox.com)
# Blog: mwdesilva.com // Expertise: desilva.io // Twitter: @bsodmike
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@bsodmike
bsodmike / README-nvr-mining-GTX1070-GTX1080.md
Created February 2, 2018 21:32
OC Nvidia GTX1070 & GTX1080 in Ubuntu 16.04LTS for ZCash mining
nvidia-xconfig --enable-all-gpus --cool-bits=31 --use-display-device="DFP-0" --connected-monitor="DFP-0"
@bsodmike
bsodmike / crontab.sh
Created January 29, 2018 22:28
Cron job to run btrfs scrub on 2x WD Purple 4TB array on custom Ubquiti NVR box.
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
#
# Every Sunday at 0100 hrs
@bsodmike
bsodmike / nintendo-switch.md
Created January 12, 2018 13:53
Mike's Nintendo Switch Bundle from Amazon