Skip to content

Instantly share code, notes, and snippets.

View fishi0x01's full-sized avatar
💾
0x01

Karl Fischer fishi0x01

💾
0x01
View GitHub Profile
@fishi0x01
fishi0x01 / terraform-0.7.11-experimental-feature-bug
Last active November 22, 2016 13:46
Terraform 0.7.11 Experimental Feature Error on aws_instance resource
While running, Terraform sometimes tests experimental features in the
background. These features cannot affect real state and never touch
real infrastructure. If the features work properly, you see nothing.
If the features fail, this message appears.
The following failures happened while running experimental features.
Please report a Terraform bug so that future Terraform versions that
enable these features can be improved!
You can report an issue at: https://github.com/hashicorp/terraform/issues
projects = [
[name: "serviceA", cron: "@daily"],
[name: "serviceB", cron: "@hourly"],
[name: "serviceC", cron: "@daily"],
]
for(project in projects) {
folder("${project.name}")
---
jenkins:
systemMessage: "Powered automagically by Groovy and Configuration-as-Code Plugin\n\n"
numExecutors: 5
crumbIssuer:
standard:
excludeClientIPFromCrumb: false
remotingSecurity:
@fishi0x01
fishi0x01 / keybase.md
Last active March 9, 2020 21:01
keybase.md

Keybase proof

I hereby claim:

  • I am fishi0x01 on github.
  • I am fishi0x01 (https://keybase.io/fishi0x01) on keybase.
  • I have a public key ASBC98LoqVmGXqBk9o2PyofHRZ7Ee5d2Yi5C09wcQsxuzAo

To claim this, I am signing this object:

node('master') {
stage('Checkout') {
// Clean workspace and checkout shared library repository on the jenkins master
cleanWs()
checkout scm
}
stage('Configuration') {
// set CasC config in master
sh('cp /var/jenkins_home/workspace/Admin/Configure/resources/config/configuration-as-code-plugin/jenkins.yaml /var/jenkins_home/jenkins.yaml')
@fishi0x01
fishi0x01 / defaults-main.yml
Last active March 21, 2020 15:17
Snippets for ansible role structuring. Code for blog post https://fishi.devtail.io/weblog/2016/06/02/ansible-role-structuring/
sshd_port: 5133
sshd_groups:
- name: devops
ssh:
allow_tcp_fwd: True
allow_agent_fwd: True
x11_fwd: True
- name: developers
ssh:
#!/bin/bash
SENSITIVE_FILES="roles/ssh/templates/sshd_config.j2.enc"
if [ "$1" != "clean" ] && [ "$1" != "decrypt" ]
then
echo "only 'clean' or 'decrypt' are allowed"
exit 1
fi
#!/usr/bin/env python3
"""
A simple python(3) bf interpreter.
First argument is .bf file with code to execute.
Optionally a file with input arguments can be specified as second argument.
"""
import sys
import re
@fishi0x01
fishi0x01 / power_set.py
Last active March 21, 2020 15:19
Bitwise Techniques for Subset Iterations in Python. Code for blog post https://fishi.devtail.io/weblog/2015/05/18/common-bitwise-techniques-subset-iterations/
#!/usr/bin/env python3
"""
Iterate over each subset of any size (Power set)
"""
def power_set(A):
subsets = []
N = len(A)
# iterate over each subset
@fishi0x01
fishi0x01 / fermat_binom.py
Last active March 21, 2020 15:19
Calculating large binomial coefficients modulo prime / non-prime numbers (nCk mod m). Code for blog post https://fishi.devtail.io/weblog/2015/06/25/computing-large-binomial-coefficients-modulo-prime-non-prime/
#!/usr/bin/env python3
"""
Using Fermat's little theorem to calculate nCk mod m, for k < m and m is prime
Two versions:
1. Pre-Compute factorials and multiplicative inverses in O(n*logn) --> later lookup in O(1)
2. Compute directly --> no lookup --> each time O(n)
"""