Skip to content

Instantly share code, notes, and snippets.

View ahmed-bacha's full-sized avatar

AAB ahmed-bacha

View GitHub Profile
@ahmed-bacha
ahmed-bacha / gist:aa60d735b447940c19593884f553e69c
Created May 29, 2017 11:27 — forked from gambol99/gist:d55afd69217b8e2dd727be99f0a20e7d
golang - create ca and build csr for signing
//
// createCertificateAuthority generates a certificate authority request ready to be signed
//
func (r *secretStore) createCertificateAuthority(names pkix.Name, expiration time.Duration, size int) (*caCertificate, error) {
// step: generate a keypair
keys, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
return nil, fmt.Errorf("unable to genarate private keys, error: %s", err)
}
@ahmed-bacha
ahmed-bacha / SOL_SOCKET-SO_PEERCRED.rb
Created February 24, 2017 16:28 — forked from hiboma/SOL_SOCKET-SO_PEERCRED.rb
SOL_SOCKET, SO_PEERCRED in ruby
#!/usr/bin/env ruby
require 'socket'
include Socket::Constants
UNIXServer.open("\0(abstract socket)") {|server|
clinet = UNIXSocket.new("\0(abstract socket)")
clinet.setsockopt(SOL_SOCKET, SO_PASSCRED, 1)
sock = server.accept
@ahmed-bacha
ahmed-bacha / GIF-Screencast-OSX.md
Created February 16, 2017 20:34 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ahmed-bacha
ahmed-bacha / iterm2-solarized.md
Created February 15, 2017 19:27 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@ahmed-bacha
ahmed-bacha / multi_logger.rb
Created October 12, 2016 19:28 — forked from clowder/multi_logger.rb
Logging to multiple destinations in Ruby
class MultiLogger
attr_reader :level
def initialize(args={})
@level = args[:level] || Logger::Severity::DEBUG
@loggers = []
Array(args[:loggers]).each { |logger| add_logger(logger) }
end
@ahmed-bacha
ahmed-bacha / logger.rb
Last active December 1, 2016 15:15 — forked from kryptykphysh/logger.rb
Ruby: Logging module with class names, output to both STDOUT and file
require 'logger'
module Logging
class MultiDelegator
def initialize(*targets)
@targets = targets
end
def self.delegate(*methods)
methods.each do |m|
@ahmed-bacha
ahmed-bacha / pci_dss.md
Created October 7, 2016 20:50 — forked from diyan/pci_dss.md
PCI DSS. Useful resources
@ahmed-bacha
ahmed-bacha / infra-secret-management-overview.md
Created August 1, 2016 13:22 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@ahmed-bacha
ahmed-bacha / Howto.md
Created November 9, 2015 21:05 — forked from n1k0/Howto.md
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true