Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo "Cleaning Xcode..."
# Clear Xcode Caches
CLEANDIRS=("~/Library/Developer/Xcode/DerivedData" \
"~/Library/Caches/org.swift.swiftpm" \
"~/Library/Caches/org.swift.swiftpm.$USER" \
"$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" \
"$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$USER/ModuleCache" \
@wheresjames
wheresjames / vscode-settings.json
Created March 29, 2024 04:12
vscode-settings.json
{
"workbench.startupEditor": "none",
"workbench.sideBar.location": "right",
"editor.renderWhitespace": "boundary",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"emmet.showAbbreviationSuggestions": false,
"editor.wordBasedSuggestions": "off",
"editor.snippetSuggestions": "none",
"editor.inlineSuggest.enabled": true,
"editor.acceptSuggestionOnCommitCharacter": false,
#include <iostream>
#include <string>
#include <vector>
#include <filesystem>
#include <cstdlib>
#include <regex>
/** This program executes a command for each file in a directory that matches a filter.
Usage : test_args <directory> <file-filter> <executable> [extra arguments...]
@wheresjames
wheresjames / cmake-tasks.sh
Last active October 17, 2023 22:51
CMake build script for Visual Studio
#!/bin/bash
# http://github.com/wheresjames
# Run this from the command line like
#
# $ ~/path/to/cmake-tasks.sh clean-config-build release build ./some/cmake/project
#
# OR
#
# $ cd ./some/cmake/project
@wheresjames
wheresjames / certrenew.sh
Created September 9, 2021 01:13
Renew cert with certbot / nginx
echo $DOMAINNAME
# Get cert expire info
EXPDATE=$(echo | openssl s_client -servername $DOMAINNAME -connect $DOMAINNAME:443 2>/dev/null | openssl x509 -noout -enddate)
EXPDATE2=${EXPDATE[@]:9}
FMTDATE=$(date --date="$EXPDATE2" "+%Y-%m-%d %H:%M:%S")
# Cert expire time
EXPTIME=$(date --date="$EXPDATE2" +%s)
function promiseWhile(cond, prom) {
return prom().then(r=> { return cond(r) ? promiseWhile(cond, prom) : r; });
}
function countTo(n) {
let i = 0;
return promiseWhile((r)=> r < n, () => {
return new Promise((resolve, reject)=> {
console.log(i);
setTimeout(()=>{i++; resolve(i);}, 1000);
@wheresjames
wheresjames / linode-deploy.sh
Created January 12, 2021 19:40
Deploy apache server to a Linode instance
#!/bin/bash
#--------------------------------------------------------------------------------------------------
#
# Examples
#
# Setup new instance
# $ ./linode-deploy.sh create-setup <username> newserver.example.com
#
# After you've added the IP address to your DNS, get a lets encrypt cert with
@wheresjames
wheresjames / gdrive.py
Created January 3, 2021 13:32
Python script to sync local folder to google drive
#!/usr/bin/env python3
from __future__ import print_function
import os
import sys
import time
import json
import random
import inspect
import argparse
@wheresjames
wheresjames / npm-global-install.js
Last active December 23, 2020 20:57
Install global npm dependencies from package.json
#!/usr/bin/node
const fs = require('fs');
const path = require('path');
const shell = require('shelljs');
const cp = require('child_process');
const c_Usage = "USAGE: ./npm-global-install.js <path-to-package.json>";
const c_start_time = new Date().getTime() / 1000;
#!/bin/bash
# Compress web site
#--------------------------------------------------------------------------------------------------
USAGE="Usage: ./compress-web.sh <source-dir> <destination-dir>"
SCRIPT_NAME=$(basename $0)
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")