Skip to content

Instantly share code, notes, and snippets.

@Dragory
Dragory / openssl.md
Created February 16, 2021 12:32 — forked from Nathaniel100/openssl.md
Generate PKCS10 request

Generate a new private key and Certificate Signing Request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

Generate a certificate signing request (CSR) for an existing private key

openssl req -out CSR.csr -key privateKey.key -new
@Dragory
Dragory / index.js
Last active October 31, 2017 14:19 — forked from anonymous/index.js
'use strict'
const fs = require('fs')
const cheerio = require('cheerio')
const request = require('request')
var Parent = this
Parent.Anime = function Anime (url) {
return new Promise((resolve, reject) => {
request(url, (err, res, body) => { // Send HTTP request to ask for
if (err) { reject(err); return } // Error handling
let $ = cheerio.load(body)
@Dragory
Dragory / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
$startIP = [1, 1, 1, 50];
$numToGenerate = 255;
// Convert the array into the binary representation
$startIP = array_map(function($num) {
return str_pad(decbin($num), 8, "0", STR_PAD_LEFT);
}, $startIP);
$startIP = implode('', $startIP); // Should be 32 bits represented as binary here (in a string)
@Dragory
Dragory / gist:c5bfc339cba06e379de6
Last active August 29, 2015 14:04
Calculating the week number
// Converts Su-Sa (0-6) to other periods, such as Mo-Su (0-6)
function weekDayWithOffset(date, offset) {
return ((date.getDay() + 7 - offset) % 7);
}
// Calculates the week number of the given date
// Thanks to http://stackoverflow.com/a/6117889/316944
function weekNum(date) {
var refDate = new Date(date.getTime());
<?php
class CustomerAffiliationController extends BaseController
{
public function index($customer_id)
{
$affiliations = Affiliation::with("AffiliationCategory", "Organism")->where("customer_id","=", $customer_id)->get();
return $affiliations;
}
<?php
namespace Services\Mivir;
class Thumbnailer
{
public function thumbnailify($path, $width, $height)
{
if ( ! file_exists($path)) {
throw new \Exception('The file to thumbnailify does not exist.');
}
(function() {
var foo = {
'foo': 5,
'bar': function() {
console.log('a');
}
};
var bar = function() {
this.foo = 5;
// Requires https://github.com/brandonaaron/jquery-mousewheel
/**
* MOUSE
*/
var mouseX = 0;
var mouseY = 0;
function trackMouse(ev)
/* SASS */
$color-bg: #fff;
$color-text: #444;
$font-size: 1.4em;
body {
font: normal 62.5%/1.4 'Arial', sans-serif;
background-color: $color-bg;
color: $color-text;
}