Skip to content

Instantly share code, notes, and snippets.

View insidegui's full-sized avatar
🧩

Guilherme Rambo insidegui

🧩
View GitHub Profile
@zorgiepoo
zorgiepoo / gist:d751cba19a0167a589a2
Last active December 23, 2024 02:33
Example program for retrieving active URLs from Safari webkit processes.
#import <Foundation/Foundation.h>
// Useful references:
// -[SMProcess webKitActiveURLs] implementation used in Activity Monitor on 10.9 (search for it using Hopper)
// http://opensource.apple.com/source/WebKit2/WebKit2-7537.71/WebProcess/mac/WebProcessMac.mm
// https://github.com/rodionovd/RDProcess/blob/master/RDProcess.m
const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey");
const int kLSMagicConstant = -1;
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@insidegui
insidegui / php_randomdotorg.php
Created June 2, 2013 00:30
Função para obter lista de números aleatórios usando a API do site random.org. Verifica a quota com o serviço e quando necessário usa números pseudo-aleatórios como fallback.
<?php
// retorna array contendo informacoes e um array de numeros aleatórios
// num -> quantidade de numeros que deve gerar
// amount -> número máximo que pode ser gerado
// force_pseudo -> não utilizar o serviço random.org e gerar números pseudo-aleatórios
function get_random_numbers($num, $amount, $force_pseudo=false)
{
// verifica a quota do servidor com o random.org para ver se é seguro fazer uma requisição agora
$c_quota = curl_init("http://www.random.org/quota/?format=plain");
curl_setopt($c_quota, CURLOPT_RETURNTRANSFER, true);
@justinHowlett
justinHowlett / gist:4611988
Last active July 9, 2024 11:53
Determine if a UIImage is generally dark or generally light
BOOL isDarkImage(UIImage* inputImage){
BOOL isDark = FALSE;
CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(inputImage.CGImage));
const UInt8 *pixels = CFDataGetBytePtr(imageData);
int darkPixels = 0;
int length = CFDataGetLength(imageData);
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active November 11, 2025 10:27
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@insidegui
insidegui / canvas.js
Created June 6, 2011 21:35
Extensões úteis para trabalhar com canvas
// frameRate padrão será 25fps
CanvasRenderingContext2D.prototype.frameRate = 1000/25
// setFrameRate(rate)
// @rate: frame rate a ser utilizado (em quadros por segundo - fps -) (ex: 30)
CanvasRenderingContext2D.prototype.setFrameRate = function(rate)
{
// transforma o frame rate passado de quadros por segundo para ms
this.frameRate = Math.round(1000/rate);
return this.frameRate;