Skip to content

Instantly share code, notes, and snippets.

View Raafas's full-sized avatar
🦁
0x8badf00d

Rafael Leandro Raafas

🦁
0x8badf00d
  • Florianópolis, SC - Brazil
View GitHub Profile
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\apps\msys64\mingw64\bin\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-Wall",
"-g",
"${file}",
@Raafas
Raafas / server.go
Created January 29, 2025 14:42
Simple HTTP server
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type Response struct {
@Raafas
Raafas / iphone-simulator-app-folder.sh
Created October 15, 2021 20:45 — forked from atika/iphone-simulator-app-folder.sh
Open the iOS Simulator folder containing -user defaults- plists files for your Application
#!/bin/bash
appname="$1"
[ -z $appname ] && read -p "Application name : " appname
apppath=$(find ~/Library/Developer/CoreSimulator/Devices/ -name "$appname.app" -print -quit)
if [[ ! -z $apppath ]]; then
echo "Found path for $appname app"
echo -e "\033[1;30m$apppath\033[0m"
appbundle=$(osascript -e "id of app \"$apppath\"")
@Raafas
Raafas / DecodableRoot.swift
Created October 14, 2021 14:44 — forked from htinlinn/DecodableRoot.swift
Decode JSON at root level based on a key
extension JSONDecoder {
func decode<T: Decodable>(_ type: T.Type, from data: Data, keyedBy key: String?) throws -> T {
if let key = key {
// Pass the top level key to the decoder.
userInfo[.jsonDecoderRootKeyName] = key
let root = try decode(DecodableRoot<T>.self, from: data)
return root.value
} else {
[{"attack":49,"defense":49,"description":"Bulbasaur can be seen napping in bright sunlight.\nThere is a seed on its back. By soaking up the sun’s rays,\nthe seed grows progressively larger.","evolutionChain":[{"id":"2","name":"ivysaur"},{"id":"3","name":"venusaur"}],"height":7,"id":1,"imageUrl":"https://firebasestorage.googleapis.com/v0/b/pokedex-bb36f.appspot.com/o/pokemon_images%2F2CF15848-AAF9-49C0-90E4-28DC78F60A78?alt=media&token=15ecd49b-89ff-46d6-be0f-1812c948e334","name":"bulbasaur","type":"poison","weight":69},{"attack":62,"defense":63,"defense:":63,"description":"There is a bud on this Pokémon’s back. To support its weight,\nIvysaur’s legs and trunk grow thick and strong.\nIf it starts spending more time lying in the sunlight,\nit’s a sign that the bud will bloom into a large flower soon.","evolutionChain":[{"id":"2","name":"ivysaur"},{"id":"3","name":"venusaur"}],"height":10,"id":2,"imageUrl":"https://firebasestorage.googleapis.com/v0/b/pokedex-bb36f.appspot.com/o/pokemon_images%2F62294490-1131-48D
@Raafas
Raafas / FirebaseCoordinator.swift
Created April 13, 2020 14:04 — forked from steipete/FirebaseCoordinator.swift
If you're as confused as I am that there's an API for custom options, yet Google still requires a file named GoogleService-Info.plist in your app, here's some swizzling that fixes that for ya. All Swift :)
class FirebaseCoordinator {
static let shared = FirebaseCoordinator()
static let initialize: Void = {
/// We modify Google Firebase (and eventually Analytics) to load the mac-specific plist at runtime.
/// Google enforces that we have a file named "GoogleService-Info.plist" in the app resources.
/// This is unfortunate since we need two different files based on iOS and Mac version
/// One solution is a custom build step that copies in the correct file:
/// https://stackoverflow.com/questions/37615405/use-different-googleservice-info-plist-for-different-build-schemes
/// However, this is basically impossible since Catalyst doesn't set any custom build variables, so detection is extremely difficult.
/// We swizzle to modify the loading times.
@Raafas
Raafas / ios_header_remover.swift
Created January 24, 2020 17:24 — forked from rockbruno/ios_header_remover.swift
iOS File Header remover script
import Foundation
func findFiles(rootPath: String, suffix: String, ignoreDirs: Bool = true) -> [String]? {
var result = [String]()
let fileManager = FileManager.default
if let paths = fileManager.subpaths(atPath: rootPath) {
let swiftPaths = paths.filter { $0.hasSuffix(suffix) }
for path in swiftPaths {
var isDir : ObjCBool = false
let fullPath = (rootPath as NSString).appendingPathComponent(path)
import UIKit
var str = "Hello, playground"
func validate(num: Int) -> Bool {
if num == 1 { return true }
else { return false }
}
# Install Node
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt install nodejs
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@Raafas
Raafas / a.txt
Last active December 18, 2018 20:14
docker-compose -f ~/agile_local_in_docker/agile_local.yml up -d
docker-compose -f ~/agile_local_in_docker/agile_local.yml up -d agile