Skip to content

Instantly share code, notes, and snippets.

View mariusvw's full-sized avatar

Marius van Witzenburg mariusvw

View GitHub Profile
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
# udev rule : SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", SYMLINK+="lsm303agr"
import serial
import re
import time
import signal
import math
# registers
@tvisser
tvisser / Afas.class.php
Last active September 19, 2017 13:24
PHP Class for easily using the Afas GetConnector or UpdateConnector
<?php
/**
* Class Afas
*
* This class has 3 static functions for accessing data using the Afas GetConnectors and UpdateConnectors.
* It includes the GET, POST and PUT request in their valid format.
*
* IMPORTANT: For it to work, remember to change the BASE_URL and TOKEN constants in the class.
*
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 19, 2024 12:30
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@mchugh19
mchugh19 / long-job.sh
Created February 18, 2016 19:50
quick salt api curl test
#!/bin/sh
JSON='[{"arg":["sleep 14; echo testing"],"client":"local","expr_form":"glob","fun":"cmd.run","tgt":"*"}]'
RESPONSE=`curl -ik https://localhost:8000/login -H 'Content-Type: application/json' -d '[{"eauth":"pam","password":"SOMEPASSWORD","username":"SOMEUSERNAME"}]' 2>/dev/null`
TOKEN=`echo $RESPONSE | grep -oP "[[:alnum:]]{40}" | uniq`
RESPONSE=`curl -ik https://localhost:8000/minions -H 'Accept: application/json' -H "X-Auth-Token: $TOKEN" -H 'Content-Type: application/json' -d "$JSON" 2>/dev/null`
JID=`echo $RESPONSE | grep -oP "[0-9]{20}" | uniq`
#echo GOT $JID
@croosen
croosen / tictactoe.py
Last active February 25, 2016 10:37
Tic Tac Toe in Python
'''
Tic Tac Toe
A very (very) basic game in Python
'''
def tictactoe():
#create an empty raster
def makeRaster(row, col):
@jaceklaskowski
jaceklaskowski / docker-for-the-impatient.md
Last active October 28, 2022 08:24
Docker for the Impatient

aka "Let's take some notes about using Docker on Mac OS X to turn deployment of Scala applications into a much better experience."

DISCLAIMER The doc is a compilation of different articles and videos found on the Internet. Almost nothing's mine - mostly layout. See CREDITS section below to know who to praise. All mistakes are mine and are not intended. Drop me an email at jacek@japila.pl if you spot any errors or just share what you think about the doc.

The document lives at https://gist.github.com/jaceklaskowski/ca55be80cb76e84ce478

Intro

I'm on Mac OS X and so you're going to see a lot of setup tweaks for the platform that are not necessarily needed for your environment, esp. Linux one. When you see boot2docker and you're on Linux, just disregard the line or even entire paragraph.

@laingc
laingc / Export Photos.app Albums
Created May 13, 2015 21:37
A (somewhat buggy) script to export all albums from Photos.app to a directory. Based on the script written by Nic Fletcher (see https://discussions.apple.com/message/28098849#28098849)
-- A (somewhat buggy) script to export all albums from Photos.app to a directory
-- Based on the script written by Nic Fletcher (see https://discussions.apple.com/message/28098849#28098849)
set srcParent to "iPhoto Events" -- Folder that album is in
set exportBase to "some:path:"
tell application "Photos"
set albList to name of every container of container srcParent
end tell
repeat with albSource in albList
set folderExists to false
@songzhou21
songzhou21 / gist:f08ae73f917d2d81f835
Last active April 1, 2022 07:13 — forked from gereon/gist:3150445
Spotlight search source files

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@raimohanska
raimohanska / enocean.ino
Created February 21, 2015 20:48
Arduino enocean dimmer
int SIGNAL_LED = 13;
int POWER_LED = 11;
byte buffer[100];
byte myAddress[] = {-1, -114, 70, -125};
void setup() {
Serial.begin(9600);
pinMode(SIGNAL_LED, OUTPUT);
pinMode(POWER_LED, OUTPUT);