Skip to content

Instantly share code, notes, and snippets.

View che-wf's full-sized avatar
👨‍💻
Working

Josh che-wf

👨‍💻
Working
View GitHub Profile
@che-wf
che-wf / get-vpn-servers.sh
Created August 28, 2023 19:35
Gets the top three NordVPN servers with the lowest load
curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output 'limit(3;.[]) | " Server: \(.name)\nHostname: \(.hostname)\nLocation: \(.locations[0].country.name) - \(.locations[0].country.city.name)\n Load: \(.load)\n"'
@che-wf
che-wf / functions.md
Created August 2, 2021 18:11
JSDoc Cheatsheet

Functions

/**
 * This is a function.
 *
 * @param {string} n - A string param
 * @return {string} A good string
 *
@che-wf
che-wf / show-git-branch-in-bash-prompt
Created March 10, 2020 21:34 — forked from stuarteberg/show-git-branch-in-bash-prompt
Code for your .bashrc file. Show current git branch on bash shell prompt....with color! (This was copied and modified from similar code you can find out there on the 'tubes.)
# Colors for the prompt
blue="\033[0;34m"
white="\033[0;37m"
green="\033[0;32m"
# Brackets needed around non-printable characters in PS1
ps1_blue='\['"$blue"'\]'
ps1_green='\['"$green"'\]'
ps1_white='\['"$white"'\]'
@che-wf
che-wf / Cmder-Settings.xml
Last active March 5, 2020 18:41
My personal settings for Cmder including the following themes: Ayu Mirage, Cobalt, Dracula, Material UI, and Panda
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2020-03-05 08:57:24" build="191012">
<value name="Language" type="string" data="en"/>
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{cmd::Cmder}"/>
<value name="StartFarFolders" type="hex" data="00"/>
@che-wf
che-wf / gateway-update.sh
Created May 5, 2019 05:34
Bash script to update Mozilla Things Gateway for those who installed it by the package instead of by the image
#!/bin/bash
# fetch your URLs
answer=`curl -s https://api.github.com/repos/mozilla-iot/gateway/releases/latest | grep "browser_download_url.*tar.gz" | cut -d : -f 2,3 | tr -d \"`
# get download names
# main gateway directory
core_file=`echo "$answer" | grep -Eo '.+?\.tar\.gz' | head -n1 | tr -d " "`
node_modules_file=`echo "$answer" | grep -Eo '.+?\.tar\.gz' | head -n2 | tail -1 | tr -d " "`
# node_modules directory
@che-wf
che-wf / svg2less.py
Last active March 27, 2019 23:37
Uses Python and lxml to create a less file with classes from an SVG font file
# Install the library
# easy_install lxml
from lxml import etree
filename = "fonts/icons.svg"
tree = etree.parse(open(filename, 'r'))
lessPreStyle = """
@font_family_1: 'icon-font';
@che-wf
che-wf / html5-blank-template
Last active October 16, 2018 18:19 — forked from macabreb0b/html5-blank-template
HTML5 Blank Template with jQuery
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blank HTML5</title>
<style>
</style>
</head>
<body>
@che-wf
che-wf / newId.js
Created October 7, 2017 00:10
Allows you to use unique prop ids
let lastId = 0;
export default function(prefix='id') {
lastId++;
return `${prefix}${lastId}`;
}
@che-wf
che-wf / mergeRequests.md
Last active September 27, 2017 01:39
A template for `issue_templates` for merge requests

Issue

(✔) Bug ( ) Feature ( ) Merge ( ) Request

The Problem

[Describe the issue]

@che-wf
che-wf / modal.css
Created July 29, 2017 01:29
Perfectly centered modaal
.modal {
max-height: calc(100% - 100px);
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}