Skip to content

Instantly share code, notes, and snippets.

View jdrydn's full-sized avatar

jdrydn jdrydn

View GitHub Profile
@jdrydn
jdrydn / SSH-Shortcut-Script.md
Created October 31, 2024 12:56
SSH-Shortcut-Script

SSH-Server

(Migrated from jdrydn/dotfiles)

A simple script to allow me to have multiple SSH server listings without clouding up my SSH config.

Example usage:

$ cd /path/to/a/working/directory
@jdrydn
jdrydn / $ Vue2-Vite-TS-SSR.md
Last active March 15, 2024 22:42
vue2 + vite + ts + ssr
Vue Vite Express
2.7.15
4.4.5
4.18.2

Here's an example for running a Vue2 + Typescript frontend with Vite & SSR. When implementing this for my own project I really struggled to find (any) examples, so hopefully this helps someone in the same situation I was in!

Key elements

@jdrydn
jdrydn / Vue-HTTP-APIG.md
Last active March 27, 2021 18:38
Serve a Vue SPA through API-Gateway

Vue HTTP API-Gateway

Serve a Vue SPA through API-Gateway.

Deploy

$ aws cloudformation deploy \
  --stack-name vue-frontend-prod \
 --template-file ./vue-http-apig.yml
if (require('cluster').isMaster) {
const cluster = require('cluster');
const CPU = require('os').cpus();
const LIMIT = process.env.LIMIT || CPU.length;
const start = Date.now();
// Generate a list of MAX numbers to loop through
const LIST = (new Array(parseInt(process.env.MAX || 10, 10))).fill(null).map((v, k) => k + 1);

Keybase proof

I hereby claim:

  • I am jdrydn on github.
  • I am jdrydn (https://keybase.io/jdrydn) on keybase.
  • I have a public key ASAA7zfX7R6N4pdJFnxZX4ff-GhgoRhawwfaikF4hLwlFQo

To claim this, I am signing this object:

A Friday Project of Sockets

@jdrydn
jdrydn / scan.js
Last active March 16, 2016 18:08
module.exports = function scanEach(redis, opts, eachFn, callback) {
var scan_args = [ opts.cursor || 0 ];
if (opts.prefix) scan_args.push('MATCH', opts.prefix);
if (opts.count) scan_args.push('COUNT', opts.count);
scan_args.push(function (err, results) {
if (err) return callback(err);
if (!Array.isArray(results)) return callback(new Error('Invalid results from redis SCAN command'));
@jdrydn
jdrydn / HINCRALLBY.lua
Last active April 19, 2017 21:25
Grab your shovels, that Redis instance won't be around much longer
-- Usage: HINCRALLBY AKeyOfYourChoice 1
-- HKEYS AKeyOfYourChoice
-- HINCRBY AKeyOfYourChoice KEY 1
-- Not sure on performance or what would happen with a hash of 100,000 keys
-- And I don't really want to find out!
local keys = redis.call("HKEYS", ARGV[1])
local results = {}
for i,k in ipairs(keys) do results[i] = redis.call("HINCRBY", ARGV[1], keys[i], ARGV[2]) end
return results
@jdrydn
jdrydn / Sherlock.md
Last active March 13, 2016 13:22
Archived the old Sherlock project

Sherlock

A simple proxy service that takes requests and send them to specific ports based on their hostname.

Nothing special at all & extremely helpful once upon a time ago.

Uses http-proxy and forever.

@jdrydn
jdrydn / csv-email.php
Created June 18, 2014 21:03
A simple script to email the results of a query as a CSV.
<?php
$query = 'SELECT id, column1, column2, column3 FROM ImportantTable WHERE something LIKE "SomethingElse%";';
exec("mysql -h 123.456.789.012 -u SomeImportantUser -p'P4ssw0rd!' BigImportantDatabase -e '$query' | sed 's/\t/,/g' > ".__DIR__."/output.csv");
$mail = new stdClass;
$mail->to = "james@jdrydn.com";
$mail->subject = "CSV Output for that query you asked for";
$mail->hash = md5(uniqid());
$mail->headers = array(