Skip to content

Instantly share code, notes, and snippets.

View thinkerman's full-sized avatar

Thinkerman thinkerman

View GitHub Profile
@thinkerman
thinkerman / self-signed-ssl-mongo.sh
Created December 5, 2021 23:36 — forked from exAspArk/self-signed-ssl-mongo.sh
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
@thinkerman
thinkerman / awesome-php.md
Created March 7, 2021 17:39 — forked from llbbl/awesome-php.md
Awesome PHP Libraries and Resources

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Categories

  • Composer
  • Composer Related
  • Frameworks
  • Micro Frameworks
@thinkerman
thinkerman / golf-club.js
Created April 30, 2020 21:22
Golf club game: Square frontend interview question
/*
Question: Given a set of golf clubs with max and min distance they can shoot being
170 -190
120-150
60-90
20-50
1-10
If given a distance to reach, find which clubs should be used to reach the given distance in an optimal way.
@thinkerman
thinkerman / marketo.php
Created October 18, 2019 03:14
Body builder function for Marketo REST API
function bodyBuilder($program_name,$reason,$source,$lookupField,$input, $id,$aic){
$body = array();
if (isset($program_name)){
$body['programName'] = $program_name;
}
if (isset($reason)){
$body['reason'] = $reason;
}
if (isset($source)){
$body['source'] = $source;
@thinkerman
thinkerman / marketo.php
Last active October 18, 2019 03:15
Token generation function for Marketo REST API
define ("MKTO_HOST", "**Your Marketo host**");
define ("MKTO_CID", "**Your Marketo Client ID");
define ("MKTO_CS","**Your Marketo Client Seccret");
//generate token
function generate_token(){
$ch = curl_init(MKTO_HOST . "/identity/oauth/token?grant_type=client_credentials&client_id=" . MKTO_CID . "&client_secret=" . MKTO_CS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
$response = json_decode(curl_exec($ch));
@thinkerman
thinkerman / wpdb-column-examples.php
Created August 26, 2019 23:16 — forked from jeffward3283/wpdb-column-examples.php
WordPress Database Examples
<?php
////////////////////////
# COLUMN EXAMPLES
////////////////////////
////////////////////////
# Add Column (after)
////////////////////////
global $wpdb;
@thinkerman
thinkerman / functions.php
Created August 9, 2018 06:31 — forked from vishalbasnet23/functions.php
Append async to wp_enqueue_script
<?php
function advanced_asyc_scripts($url) {
if ( strpos( $url, '#asyncload') === false ) {
return $url;
} else if ( is_admin() ) {
return str_replace( '#asyncload', '', $url );
} else {
return str_replace( '#asyncload', '', $url )."' async='async' defer='defer";
}
}
@thinkerman
thinkerman / README.md
Created June 19, 2018 14:17 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
<?php
$id = 75482;
$password = '3A90E5J0f6OUIfqN1Qu59gYrjDgDblfL';
$card = '4627081718568608';
$ssl_verify = TRUE;
$data = <<<XML
<oper>cmt</oper>
<wait>0</wait>
<test>0</test>