Skip to content

Instantly share code, notes, and snippets.

@cheshirecode
cheshirecode / .bash_profile
Last active July 26, 2018 07:30 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
#!/usr/bin/env bash
# based on https://gist.github.com/natelandau/10654137
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
@cheshirecode
cheshirecode / Package Control.sublime-settings
Last active April 28, 2017 05:08
Package Control.sublime-settings
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AlignTab",
"Babel",
"Chain of Command",
@cheshirecode
cheshirecode / yarn-babylon-fix.sh
Last active October 17, 2016 05:39
(DO NOT modify) Fix babylon version to 6.11.2 in yarn.lock file for Yarn
#! /bin/bash
IFS='%'
if [ -f yarn.lock ]
then
n=`grep -n 'babylon@^6.0.18' yarn.lock | cut -d: -f 1`
while read line;do
if((i==n));then
echo ' version "6.11.2"'
elif((i==n+1));then
echo ' resolved "https://registry.npmjs.org/babylon/-/babylon-6.11.2.tgz"'
@cheshirecode
cheshirecode / sublime-config.txt
Last active March 2, 2022 09:07
Sublime editor support for HTML within ES6 template strings
Find Sublime config folder:
- Windows: %APPDATA%\Sublime Text 2
- OS X: ~/Library/Application Support/Sublime Text 2
- Linux: ~/.config/sublime-text-2
Open up [CONFIG]/Packages/Babel/JavaScript (Babel).sublime-syntax in editor.
Search for the section template-string-body, add these to the beginning:
- meta_content_scope: text.html.basic.embedded.js
- include: scope:text.html.basic
@cheshirecode
cheshirecode / addPSMenuItem.ps1
Created April 28, 2017 02:35
Add context menu item to start an elevated PowerShell from Windows Explorer
$menu = 'Open Windows PowerShell Here as Administrator'
$command = "$PSHOME\powershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""
'directory', 'directory\background', 'drive' | ForEach-Object {
New-Item -Path "Registry::HKEY_CLASSES_ROOT\$_\shell" -Name runas\command -Force |
Set-ItemProperty -Name '(default)' -Value $command -PassThru |
Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
Set-ItemProperty -Name HasLUAShield -Value ''
}
@cheshirecode
cheshirecode / download-svg-as-png.js
Last active May 24, 2022 11:48
convert SVG element to PNG and download it
//takes an SVG element, draws it on a new canvas element, convert to dataURI type PNG and download it through clicking on <a>
//based on
//https://gist.github.com/mbostock/6466603
//https://gist.github.com/gustavohenke/9073132
//http://bl.ocks.org/biovisualize/8187844
export default (svg) => {
const svgData = new XMLSerializer().serializeToString( svg );
const svgSizes = svg.getBoundingClientRect();
const canvas = document.createElement("canvas")
@cheshirecode
cheshirecode / cleanup.bat
Last active October 2, 2017 05:22
Cleanup Windows 10 bloatware
::taken from https://www.reddit.com/r/pcmasterrace/comments/736tfh/skype_is_officially_bloatware_uninstalled_it/dno65sy/
@rem *** Disable Some Service ***
sc stop DiagTrack
sc stop diagnosticshub.standardcollector.service
sc stop dmwappushservice
sc stop WMPNetworkSvc
sc stop WSearch
sc config DiagTrack start= disabled
@cheshirecode
cheshirecode / install-chrome.sh
Last active November 2, 2017 09:25
Install Chrome in Ubuntu
#!/bin/bash
# https://www.ubuntuupdates.org/ppa/google_chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -;
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list';
sudo apt-get -y update;
sudo apt -y autoremove;
sudo apt-get -y install google-chrome-stable;
@cheshirecode
cheshirecode / docker-helpers.ps1
Last active February 27, 2018 07:40
Helper Docker functions
# remove docker images by tag, default is *none*. *blah* to remove those with tags similar to "blah"
function __dockerRemoveImageByTag__ {
param( [string]$tag = "*none*" )
docker images -a | ForEach-Object {
If($_ -like $tag) {
Write-Output $_
docker rmi -f $($_.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)[2]) 2> $null
}
}
}
@cheshirecode
cheshirecode / rn-clean.sh
Created June 28, 2018 09:37
Clean up RN project, cache and node_modules
#!/bin/sh
watchman watch-del-all
rm -rf $TMPDIR/react-native-packager-cache-*
rm -rf $TMPDIR/metro-bundler-cache-*
rm -rf /tmp/haste-map-react-native-packager-*
rm -rf node_modules/ **/node_modules