Skip to content

Instantly share code, notes, and snippets.

View jimfrenette's full-sized avatar

Jim Frenette jimfrenette

View GitHub Profile
@jimfrenette
jimfrenette / resolv.sh
Last active December 20, 2023 23:52
For WSL2 Linux: get IP from `/etc/resolv.conf` and update `/etc/hosts`. A use case for this is when you want to target localhost on Windows from Linux on WSL2. https://jimfrenette.com/2020/07/wsl2-windows-terminal/
#!/usr/bin/env bash
# the directory that contains this script
base=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
function removehost() {
if [ -n "$(grep $HOSTNAME /etc/hosts)" ]
then
echo "$HOSTNAME Found in your /etc/hosts, Removing now...";
sudo sed -i".bak" "/$HOSTNAME/d" /etc/hosts
@jimfrenette
jimfrenette / hvm.sh
Last active July 15, 2023 00:40
Hugo version switcher and installer tested with Linux and OS X 64 bit releases from https://github.com/gohugoio/hugo/releases
#!/usr/bin/env bash
# the directory that contains this script
base=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# -----------------------
# Hugo Version Manager
# Author: Jim Frenette
# May 21, 2019
@jimfrenette
jimfrenette / create6.5.sh
Created February 6, 2020 21:47
spin up a AEM 6.5 instance in sibling directory
#!/usr/bin/env bash
# the directory that contains this script
base=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd $base
# param 1, specify port (optional)
if [ "$1" != "" ]; then
PORT=$1
echo "Installing for author on port $PORT"
@jimfrenette
jimfrenette / .content.xml
Last active December 17, 2019 14:00
AEM Touch UI Component Dialog - Picture component tabs jumpstart
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="nt:unstructured"
jcr:title="Picture" sling:resourceType="cq/gui/components/authoring/dialog"
mode="edit" helpPath="style-guide.html#picture">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
@jimfrenette
jimfrenette / aem-publish
Created August 22, 2019 13:31
init.d script for starting AEM publish as a service
#!/bin/bash
#
# /opt/aem/service/aem-publish
#
#
# # of the file to the end of the tags section must begin with a #
# character. After the tags section, there should be a blank line.
# This keeps normal comments in the rest of the file from being
# mistaken for tags, should they happen to fit the pattern.>
#
@jimfrenette
jimfrenette / aem-author
Created August 22, 2019 13:30
init.d script for starting AEM author as a service
#!/bin/bash
#
# /opt/aem/service/aem-author
#
#
# # of the file to the end of the tags section must begin with a #
# character. After the tags section, there should be a blank line.
# This keeps normal comments in the rest of the file from being
# mistaken for tags, should they happen to fit the pattern.>
#
@jimfrenette
jimfrenette / Homestead.yaml
Created March 21, 2017 00:36
Sample Laravel Homestead config
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
@jimfrenette
jimfrenette / docker-compose.yml
Last active October 5, 2018 01:25
local dev docker-compose file for wordpress site
version: "2"
services:
mariadb:
# image: wodby/mariadb:10.2-3.0.2
image: wodby/mariadb:10.1-3.0.2
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
@jimfrenette
jimfrenette / package.json
Created August 13, 2018 11:45 — forked from coryhouse/package.json
Example of pre and post scripts in package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"prebuild": "echo I run before the build script",
"build": "cross-env NODE_ENV=production webpack",
"postbuild": "echo I run after the build script"
}
}
@jimfrenette
jimfrenette / install_monaco_font.sh
Created August 9, 2018 21:41 — forked from rogerleite/install_monaco_font.sh
Install Monaco font in Linux
#!/bin/bash
#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/
cd /usr/share/fonts/truetype/
#TODO: put validation if folder already exists
sudo mkdir ttf-monaco