Skip to content

Instantly share code, notes, and snippets.

@designeng
designeng / add-new-user.sh
Last active January 30, 2024 00:52 — forked from teocci/add-new-user.sh
A simple bash shell script to create a linux user and optionally make them a sudoer
#!/bin/bash
ROOT_UID=0 # Only users with $UID 0 have root privileges.
E_NOTROOT=87 # Non-root exit error.
# Run as root only (sudo counts)
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "You need root priveledges to run this script"
exit $E_NOTROOT
@designeng
designeng / ffmpeg-to-480p.sh
Created February 24, 2023 16:42 — forked from blacklee/ffmpeg-to-480p.sh
ffmpeg convert video to 480p
ffmpeg -i input.mp4 -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 output.mp4
@designeng
designeng / free-database-hosting.md
Created September 26, 2022 18:51 — forked from bmaupin/free-database-hosting.md
Free database hosting
@designeng
designeng / index.js
Created July 17, 2022 11:19 — forked from jbesw/index.js
Language translation with S3 and AWS Translate
/*
MIT No Attribution
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.
@designeng
designeng / git-cheat-sheet.md
Created December 22, 2021 16:38 — forked from loonies/git-cheat-sheet.md
Git Cheat Sheet

Git Cheat Sheet

Although there are enough resources on the web about Git, I will keep this one for my own reference. Minimal Git version required 1.7.2.

TOC

@designeng
designeng / Form.vue
Last active November 29, 2021 08:18
Emit event on selector option click
<!-- parent form component -->
<template>
<form>
<FormSelector
:options="users"
:selected="currentUser"
@change="onUserChange($event)"
/>
</form>
@designeng
designeng / parse_gist.js
Created September 20, 2021 21:33 — forked from tchittick/parse_gist.js
Recursion through a Cheerio.js object and writing to .CSV
/*An object created to parse through a large number of HTML
blocks quickly. Used with cheerio.js. Begin via:
parse.run($('some-div')[0])
*/
var fs = require('fs'),
cheerio = require('cheerio');
var Parse = function(block) {
@designeng
designeng / MANUAL.md
Created January 28, 2021 12:27 — forked from kimyvgy/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@designeng
designeng / blueGreenDeployment.js
Created September 22, 2020 18:08 — forked from brandonros/blueGreenDeployment.js
node.js + nginx + PM2 rolling release/blue green deployments (zero downtime)
const Promise = require('bluebird');
const fs = require('fs');
const execa = require('execa');
class BlueGreenDeployment {
constructor({appName, blueProxyPassPattern, greenProxyPassPattern, nginxConfigFile}) {
this.appName = appName;
this.blueProxyPassPattern = blueProxyPassPattern;
this.greenProxyPassPattern = greenProxyPassPattern;
this.nginxConfigFile = nginxConfigFile;
@designeng
designeng / gist:660d298d706e7750a86e4d219f20bcee
Created September 10, 2020 08:52
Docker remove stopped containers & dangling images
# Remove all stopped containers:
docker rm $(docker ps -a -q)
# Remove all dangling Docker images:
docker rmi $(docker images -f "dangling=true" -q)