Skip to content

Instantly share code, notes, and snippets.

View SiestaDigital's full-sized avatar

Justin Gee SiestaDigital

View GitHub Profile
var fs = require('fs');
fs.readFile('data.json', function(err, json) {
if (err) throw err;
var data = JSON.parse(json);
// do stuff with data
data.foo = 'bar';
var newJson = JSON.stringify(data);
fs.writeFile('newData.json', newJson, function(err) {
@SiestaDigital
SiestaDigital / disable.sh
Last active January 2, 2020 18:52
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@SiestaDigital
SiestaDigital / writeJsonToFile.js
Created December 20, 2019 23:41 — forked from collingo/writeJsonToFile.js
Save pretty printed json to file in node
var outputLocation = require('path').resolve(__dirname, 'file.json');
require('fs').writeFile(outputLocation, JSON.stringify(data, null, 4), function(err) {
if(err) {
console.log(err);
} else {
console.log("JSON saved to "+outputLocation);
}
});
@SiestaDigital
SiestaDigital / pyenv+virtualenv.md
Created October 11, 2019 20:44 — forked from eliangcs/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv