Skip to content

Instantly share code, notes, and snippets.

View CesarBalzer's full-sized avatar

Cesar E. Balzer CesarBalzer

View GitHub Profile
@CesarBalzer
CesarBalzer / app.js
Created September 23, 2016 19:29 — forked from fer-ri/app.js
Cordova Exit App Confirm
document.addEventListener("deviceready", deviceisready, false);
function deviceisready(){
alert("Device Ready is called");
document.addEventListener("backbutton", function(e){
if ( $('.ui-page-active').attr('id') == 'mainpage') {
//window.location = "#exitDialog";
exitAppPopup();
}else{
history.back();
@CesarBalzer
CesarBalzer / mbp-gpu-fix.sh
Created March 1, 2019 13:11
A fix for GPU kernel panics on the Mid 2010 MacBook Pro.
#!/usr/bin/env bash
if csrutil status | grep -q "enabled"; then echo "You must disable SIP first."; exit 1; fi
KEXT=/System/Library/Extensions/AppleGraphicsPowerManagement.kext
sudo plutil -replace IOKitPersonalities.AGPM.Machines.MacBookPro6,2.Vendor10deDevice0a29 -json '{"BoostPState":[2,2,2,2],"BoostTime":[2,2,2,2],"Heuristic":{"Threshold_Low":[0,0,0,200],"IdleInterval":10,"SensorSampleRate":10,"Threshold_High_v":[0,0,98,100],"TargetCount":1,"SensorOption":1,"Threshold_High":[0,0,100,200],"ID":0,"Threshold_Low_v":[0,0,4,200]},"control-id":17}' $KEXT/Contents/Info.plist
sudo touch /System/Library/Extensions
sudo kextload -v $KEXT
const Model = require( './model' )
const createController = '../../helpers/createController'
module.exports = require( createController )( Model )( __dirname )
@CesarBalzer
CesarBalzer / API.md
Created August 2, 2019 00:45 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@CesarBalzer
CesarBalzer / json_to_csv.js
Created September 3, 2019 12:18 — forked from dannypule/json_to_csv.js
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];
@CesarBalzer
CesarBalzer / soap-curl-shell
Created September 27, 2019 00:45 — forked from gustavohenrique/soap-curl-shell
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>
@CesarBalzer
CesarBalzer / GoogleDrive.js
Created October 20, 2019 17:21
Google Drive Upload Image and Make Public and Get Link with NodeJS
/*
// credentials.json
{
"installed": {
"client_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com",
"project_id": "XXXXXXXXXXXXXXXXXXXXXXXX",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",