Skip to content

Instantly share code, notes, and snippets.

View FuriouslyCurious's full-sized avatar
📚
Studying

Furiously Curious FuriouslyCurious

📚
Studying
View GitHub Profile
@gcman105
gcman105 / sshd_config hardened
Created August 5, 2017 21:47
Ubuntu 16.04 /etc/ssh/sshd_config hardened
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
@dgrtwo
dgrtwo / mnist_pairs.R
Created May 31, 2017 18:56
Comparing pairs of MNIST digits based on one pixel
library(tidyverse)
# Data is downloaded from here:
# https://www.kaggle.com/c/digit-recognizer
kaggle_data <- read_csv("~/Downloads/train.csv")
pixels_gathered <- kaggle_data %>%
mutate(instance = row_number()) %>%
gather(pixel, value, -label, -instance) %>%
extract(pixel, "pixel", "(\\d+)", convert = TRUE)
@felixgwu
felixgwu / fc_densenet.py
Created April 2, 2017 05:22
FC-DenseNet Implementation in PyTorch
import torch
from torch import nn
__all__ = ['FCDenseNet', 'fcdensenet_tiny', 'fcdensenet56_nodrop',
'fcdensenet56', 'fcdensenet67', 'fcdensenet103',
'fcdensenet103_nodrop']
class DenseBlock(nn.Module):
@noogen
noogen / ubuntu-16-04-hardening-stage1.md
Last active January 15, 2021 09:09
Ubuntu 16.04 hardening - stage1

From Fresh install

1) update and upgrade as root

apt-get update && apt-get upgrade -y
  • Setting up hostname, skip if done with installation

pico /etc/hosts

@renier
renier / super_harden_ubuntu.sh
Last active February 10, 2019 02:05
Super Harden Ubuntu
#!/bin/bash
# https://developer.ibm.com/answers/questions/462237/error-groot-must-be-grub-root-device-on-ubuntu/
sed -i -e 's/LABEL=cloudimg-rootfs/(hd0)/' /boot/grub/menu.lst
apt-get update > /dev/null
apt-get install unattended-upgrades -y
timeout 20m unattended-upgrade
apt-get autoremove -y
apt-get autoclean -y
@renier
renier / harden_ubuntu.sh
Last active September 8, 2017 05:56
Harden Ubuntu
#!/bin/bash
apt-get update
apt-get upgrade -y
apt-get autoremove -y
apt-get autoclean -y
apt-get install ufw -y
apt-get install denyhosts -y
# Configure firewall
@w1ndy
w1ndy / seccomp.json
Created September 20, 2016 15:27
Allowing numactl in docker container
{
"defaultAction": "SCMP_ACT_ERRNO",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
"syscalls": [
{
"name": "accept",
__=2;print(1/(
- ~ - ~ - ~ - ~ - ~ - ~ - ~ -
~ __/ ~ - ~ - ~ - ~ - ~ - ~ - ~
- __/ - ~ - __/ - ~ __/ ~ - __/__/ ~ -
~ __/ ~ - ~ __/ ~ - __/ - ~ - ~ __/ ~
- __/ - ~ - __/ - ~ __/ ~ - __/__/__/ -
~ __/ ~ - ~ __/ ~ - __/ - __/ - ~ __/ ~
- __/__/__/__/ ~ __/__/__/ ~ - __/__/__/ -
~ - ~ - ~ - ~ - ~ - ~ - ~ - ~
@cburgdorf
cburgdorf / xor_keras.py
Last active November 18, 2020 11:23
Comparing XOR between tensorflow and keras
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
training_data = np.array([[0,0],[0,1],[1,0],[1,1]], "float32")
target_data = np.array([[0],[1],[1],[0]], "float32")
model = Sequential()
model.add(Dense(32, input_dim=2, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
@farrajota
farrajota / binary_tree_torch.lua
Last active May 1, 2017 14:48
Small example on how to create a binary tree in Torch7 using NN containers and nngraph.
--[[
Create a binary tree using two ways: NN containers and nn.gModule containers.
This example is fairly simple, and the default fully-connected layers are all
of size 100. However, this should also be simple to modify to allow different
fc layers with varying inputs/outputs if desired (for example: input a table
storing input+output configuration values for each of the sub-branch's level).
]]
require 'nn'
require 'nngraph'