Skip to content

Instantly share code, notes, and snippets.

🌞
DO YOU EVEN ADHERE BRO

Naftuli Kay naftulikay

🌞
DO YOU EVEN ADHERE BRO
Block or report user

Report or block naftulikay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@naftulikay
naftulikay / mackie.py
Created Sep 8, 2016
Get 32 most or least significant bits of a MAC address - format a MAC address as a 32 bit integer.
View mackie.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from math import floor, log
def binary_macaddress(macaddress):
"""Convert a mac address into a 48-bit integer."""
binary = 0
@naftulikay
naftulikay / tls-info.sh
Created Sep 7, 2016
Get TLS connection information for a given server.
View tls-info.sh
#!/bin/bash
function usage() {
echo "Usage: $0 hostname [port]" >&2
echo " hostname Hostname of the server to connect to." >&2
echo " port Port of the server running TLS, defaults" >&2
echo " to 443." >&2
echo ""
exit 1
}
View selinux.md

rfkrocktk

I've been hacking on this for a bit, but I'm trying to write a policy using the reference policy to contain Syncthing. I've done most of the files level permissions, but I'm having trouble with the networking aspects. My code is here: https://github.com/rfkrocktk/syncthing/blob/feature/selinux/etc/selinux/syncthing.te#L80 I'm still getting the following denied:

type=AVC msg=audit(1469458131.894:6800): avc:  denied  { create } for  pid=18349 comm="syncthing" scontext=unconfined_u:unconfined_r:syncthing_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:syncthing_t:s0-s0:c0.c1023 tclass=tcp_socket permissive=0
@naftulikay
naftulikay / color-spaces.pl
Created Jul 24, 2016
Test Terminal Color Support
View color-spaces.pl
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
print "256 color mode\n\n";
# display back ground colors
for ($fgbg = 38; $fgbg <= 48; $fgbg +=10) {
View osx-reinstall.md

OSX Reinstall for Linux Users

  1. Make sure that there is at least 128MiB of free space after your OSX root partition. OSX [needs this space for upgrading itself][osx-128]. OSX will fail to upgrade otherwise.
    1. If this gap doesn't exist and you need it to, boot into a Linux LiveCD with GParted.
    2. Delete the OSX boot and recovery partitions (don't worry, we still have internet recovery mode).
    3. Create a single HFS+ filesystem where the partitions used to be.
    4. Leave 128MiB or more free after the partition! Probably more, maybe the recovery partition needs to occupy this space.
  2. Boot into Internet Recovery mode using a Thunderbolt ethernet adapter or the built-in ethernet adapter if present. This can be accomplished by holding Alt+Super+R on boot.
@naftulikay
naftulikay / ubuntu-lts-xenial-macbook-suspend.patch
Created Jul 21, 2016
Ubuntu LTS Xenial MacBook Suspend Patch
View ubuntu-lts-xenial-macbook-suspend.patch
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1595f4f..b577af2 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2749,6 +2749,13 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
+static void quirk_hotplug_bridge_skip(struct pci_dev *dev)
+{
View 90-schiit-fulla.rules
SUBSYSTEMS=="usb", ACTION=="add|change", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="1066", RUN+="/usr/local/bin/schiit-fulla-switch added"
SUBSYSTEMS=="usb", ACTION=="remove", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="1066", RUN+="/usr/local/bin/schiit-fulla-switch removed"
@naftulikay
naftulikay / stringpiper.py
Created May 31, 2016
Pipe a String into a Program's Input in Python
View stringpiper.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
import subprocess
from StringIO import StringIO
def __main__():
@naftulikay
naftulikay / piper.py
Created May 30, 2016
Pipe Two Programs together in Python
View piper.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
import subprocess
def __main__():
parser = argparse.ArgumentParser(prog="piper", description="Pipes output of two programs together.")
parser.parse_args()
@naftulikay
naftulikay / cloudformation-victory.md
Last active May 5, 2016
How to Make CloudFormation Not Suck So Bad
View cloudformation-victory.md

CloudFormation Victory

Or: "How to Make CloudFormation Not Suck So Bad." Basically, we need to incorporate all of the best-of features of various wrapper projects.

stacks

Good Things:

You can’t perform that action at this time.