Skip to content

Instantly share code, notes, and snippets.

View favasconcelos's full-sized avatar
🇧🇷
(:

Felipe Vasconcelos favasconcelos

🇧🇷
(:
View GitHub Profile
@akirahrkw
akirahrkw / gist:ce3c52ae79f3b5de5a01
Created October 31, 2014 17:09
manipulate pixel data by swift
class BaseImageProcessor {
func createARGBBitmapContext(imageRef : CGImageRef) -> CGContextRef! {
var pixelWidth:UInt = CGImageGetWidth(imageRef);
var pixelHeight:UInt = CGImageGetHeight(imageRef);
var bitmapBytesPerRow:UInt = (pixelWidth * 4)
var bitmapByteCount:UInt = (bitmapBytesPerRow * pixelHeight)
var colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB()
@soheilhy
soheilhy / nginxproxy.md
Last active June 22, 2025 20:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 19, 2025 14:33
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active May 19, 2025 10:27
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
mkdir -p ~/.ssh
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
@aras-p
aras-p / preprocessor_fun.h
Last active June 24, 2025 08:18
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {