Skip to content

Instantly share code, notes, and snippets.

View mcmoe's full-sized avatar

Morgan Kobeissi mcmoe

View GitHub Profile
@mcmoe
mcmoe / ntp-update-linux.md
Last active November 27, 2018 13:04
Update OS time based on specific NTP server
sudo /etc/init.d/ntp stop
sudo ntpdate -s server.company.com
@mcmoe
mcmoe / download-svg-from-web.js
Last active October 23, 2018 13:11
A quick way to download an SVG from a webpage
var e = document.createElement('script');
e.setAttribute('src', 'https://nytimes.github.io/svg-crowbar/svg-crowbar.js');
e.setAttribute('class', 'svg-crowbar');
document.body.appendChild(e);
/* Source: https://graphicdesign.stackexchange.com/questions/55123/how-do-i-save-an-svg-thats-on-a-website-to-my-computer */
@mcmoe
mcmoe / echarts4-linear-gradient-color.js
Created October 18, 2018 14:11
How to create a Linear Gradient color in echarts 4
// ...
const color = this._colors[i % this._colors.length];
const colorNext = echarts.color.lift(color, 0.3);
return {
type: 'linear',
x: 0,
y: 1,
x2: 0,
y2: 0,
@mcmoe
mcmoe / java-keytool.md
Last active February 15, 2024 08:24
Creating a keystore and truststore using the Java keytool plus useful check and modification keytool commands

Creating a keystore and exporting its certificate into a new truststore

Create the Keystore and generate a certificate, an example is shown below:

keytool -genkey -alias client -keyalg RSA -keystore client.jks -keysize 2048

Export a certificate from a Keystore:

keytool -export -alias client -file client.crt -keystore client.jks

Import the certificate to a Truststore:

keytool -import -v -trustcacerts -alias client -file client.crt -keystore clienttrust.jks

@mcmoe
mcmoe / OpenSSL cheat sheet for socket programmers.md
Created June 3, 2018 16:34 — forked from azadkuh/OpenSSL cheat sheet for socket programmers.md
OpenSSL cheat sheet. This is a brief howto for socket programmers.

#OpenSSL cheat sheet This is a brief howto for socket programmers.

create RSA key pairs

ex: 1024bits length key pair:

$> openssl genrsa -out myprivate.pem 1024
$> openssl rsa -in myprivate.pem -pubout -out mypublic.pem
@mcmoe
mcmoe / gradle-compile-local-project-dependency.markdown
Created August 25, 2017 08:39
How to link to a local Gradle dependency and compile it from source

add this to your settings.gradle

include ':my-other-project'
project(':my-other-project').projectDir = new File(settingsDir, '../my-other-project')

then you can link to it in your build.gradle like so

@mcmoe
mcmoe / html5-video-player-template.html
Created June 29, 2016 12:40
HTML5 video player template with playback rate and css based on videojs
<link href="https://vjs.zencdn.net/5.10.4/video-js.css" rel="stylesheet">
<div>
<video id="my-video" class="video-js" controls preload="auto" width="300" height="480" data-setup='{"playbackRates": [1, 1.5, 2] }'>
<source src="<!------- ADD VIDEO LINK HERE ------>" type='video/mp4'>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
</div>
@mcmoe
mcmoe / pipeline-common.css
Created June 5, 2015 17:12
Delivery Pipeline common css
div.hide {
visibility: hidden;
}
div.pipeline-loading-icon {
content: url("white-load.gif");
display: block;
margin-left: auto;
margin-right: auto
}