Skip to content

Instantly share code, notes, and snippets.

View marcosbrasil's full-sized avatar
🌵
Always start small, never play small

Marcos Brasil marcosbrasil

🌵
Always start small, never play small
View GitHub Profile
@marcosbrasil
marcosbrasil / 1.txt
Created May 16, 2021 04:20 — forked from huksley/disabling-photoanalysisd.md
Disabling photoanalysisd
For what it's worth (and with all the usual disclaimers about potentially making your mac unstable by disabling system services), here's some commands that will manipulate this service and services like it. Note the $UID in the command, that's just a bash shell variable that will resolve to some number. That's your numeric UID. You just run these commands from a Terminal command line. No special privileges needed.
If you want to disable it entirely, the first command stops it from respawning, and the second kills the one that is currently running:
launchctl disable gui/$UID/com.apple.photoanalysisd
launchctl kill -TERM gui/$UID/com.apple.photoanalysisd
(If you kill it without disabling it will die, but a new one will respawn and pick up where the old one left off)
I don't have this problem myself, so I can't try these next two commands. They're relying on good ole UNIX signals. You could theoretically suspend and resume the process like this ("STOP" and "CONT" are stop and continue):
@marcosbrasil
marcosbrasil / airports_BRA.json
Last active February 24, 2022 12:50
Brazillian Airports Datum nodes translated to pt-BR for use in Twitter Typeahead search (http://twitter.github.io/typeahead.js/)
[
{
"code": "AAX",
"lat": "-19.5603",
"lon": "-46.9653",
"name": "Aeroporto de Romeu Zuma",
"display_name": "Arax\u00e1 - (AAX)",
"city": "Arax\u00e1",
"state": "Minas Gerais",
"country": "Brazil",
This file has been truncated, but you can view the full file.
[
{
"code": "AAA",
"lat": "-17.3595",
"lon": "-145.494",
"name": "Anaa Airport",
"city": "Anaa",
"state": "Tuamotu-Gambier",
"country": "French Polynesia",
"woeid": "12512819",
@marcosbrasil
marcosbrasil / aws_aim.bat
Created April 26, 2013 14:08
Configuração de ambiente (Windows) para conexão ao Amazon AWS command line.
@ECHO OFF
color 8e
echo ***************************************************************
echo * Configuration Enviroment for AMAZON AIM Command Line Prompt *
echo ***************************************************************
echo .
echo Created by Marcos Brasil - markus.prologic@gmail.com
echo ===============================================================
echo Setting AWS IAM HOME directory variable...
@marcosbrasil
marcosbrasil / gist:5123152
Created March 9, 2013 06:33
Simulando Estrutura de Árvore Binária em Javascript - Una - Estrutura de Dados e Arquivos
<html>
<head>
<title>Array random without duplicates - Tree Search</title>
</head>
<body>
<h2>Array random without duplicates - Tree Search</h2>
<div id="display_tree">
<table width="600px">
<tr><td><table width="100%"><tr><td align="center" id="1"></td></tr></table></td></tr>
@marcosbrasil
marcosbrasil / inspect_cpus.js
Created September 2, 2012 03:01
Inspect CPU usage with nodejs os.cpus() module
var os = require("os");
var exec = require('child_process').exec;
function sysLog(){
//exec('clear', sysLog);
var cpus = os.cpus();
for(var i = 0, len = cpus.length; i < len; i++) {
var cpu = cpus[i], total = 0, processTotal = 0, strPercent = '';
@marcosbrasil
marcosbrasil / time_countdown.js
Created August 29, 2012 20:38
Regressive time countdown in javascript
var YY = 2012;
var MM = 12;
var DD = 3;
var HH = 14;
var MI = 5;
var SS = 0;
function atualizaContador() {
var hoje = new Date();
var futuro = new Date(YY,MM-1,DD,HH,MI,SS);
@marcosbrasil
marcosbrasil / preloadImages.js
Created July 17, 2012 14:47
Simple extend jquery plugin for load images into DOM
var cache = [];
// Arguments are image absolute paths to the current page
$.preLoadImages = function(arrImg,funcCallback) {
var imgLen = arrImg.length;
for (var i = imgLen; i>=0 ;i--) {
if(typeof arrImg[i] !== 'undefined'){
var cacheImage = document.createElement('img');
cacheImage.src = arrImg[i];
cache.push(cacheImage);
@marcosbrasil
marcosbrasil / text_cut.php
Created June 21, 2012 13:54
FUnção PHP para limitar texto sem cortar palavras
<?php
function limitarTexto($texto, $limite){
$texto = substr($texto, 0, strrpos(substr($texto, 0, $limite), ' ')) . '...';
return $texto;
}
// String a ser limitada
$string = 'Como limitar caracteres sem cortar as palavras com PHP';
// Mostrando a string limitada em 25 caracteres.
@marcosbrasil
marcosbrasil / mind_logo.js
Created May 31, 2012 14:59
Logo da Mind em canvas
function mindToCanvas(){
var c = document.getElementById('logo-mind');
c.height = 72;
c.width = 185;
var cx = c.getContext('2d');
cx.fillStyle="rgba(249,255,244,1)";
cx.fillRect(0,0,1,1);
cx.fillStyle="rgba(252,255,253,1)";
cx.fillRect(1,0,1,1);
cx.fillStyle="rgba(252,255,255,1)";