Skip to content

Instantly share code, notes, and snippets.

@carlossless
carlossless / dnsmasq-for-localhost-on-macos.md
Last active May 2, 2019
Setup dnsmasq for .localhost domains on macOS
View dnsmasq-for-localhost-on-macos.md

.localhost domains on macOS with dnsmasq

  1. Install dnsmasq
brew install dnsmasq
  1. Add an address entry to point everything under .dev to 127.0.0.1 in /usr/local/etc/dnsmasq.conf
echo "address=/.localhost/127.0.0.1" >> "$(brew --prefix)"/etc/dnsmasq.conf
@carlossless
carlossless / check_instrumentation.sh
Created Sep 14, 2017
Check Carthage dependency binaries for LLVM Instrumentation symbols
View check_instrumentation.sh
#!/usr/bin/env bash
FRAMEWORK_BINARIES=$(find . -path "./Carthage/Build/*.framework/*" -type f -maxdepth 5 ! -name "*.*")
check_framework () {
printf "Checking $1..."
if OTOOL_OUTPUT=$(otool -l -arch all "$1" | grep __llvm_prf) ; then
printf " LLVM instrumentation symbols found:\n"
printf "$OTOOL_OUTPUT\n\n"
else
@carlossless
carlossless / UncurryBuilder.swift
Created Jun 18, 2017
A little Swift 4.0 script to build uncurry functions for https://github.com/carlossless/Uncurry
View UncurryBuilder.swift
import Foundation
var chars = "ABCDEFGHIJKLMNOPQRSTU"
let charStrings = chars.characters
.map{ String($0) }
func buildFunc(charStrings: [String], index: Int) -> String {
let lowerCaseChars = charStrings.map { $0.lowercased() }
let upperCaseChars = charStrings.map { $0.uppercased() }
@carlossless
carlossless / Info.plist
Last active Jul 9, 2020
ATMEL ICE on OS X
View Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.atmel.driver.dummy</string>
@carlossless
carlossless / post-commit-global-log.sh
Created Sep 26, 2016
A script to log the last commit message to the users shared git log
View post-commit-global-log.sh
#!/bin/bash
# A script to log the last commit message to the users shared git log
# Useful to keep track of what you did durring a specific day
LOG_PATH="$HOME/gitlogs"
DATE=`date +'%Y-%m-%d'`
COMMIT=`git log --color --graph --pretty=format:'%h %s' -1 HEAD`
REPO_PATH=`git rev-parse --show-toplevel`
REPO_NAME=`basename "$REPO_PATH"`
@carlossless
carlossless / uninstall-cocoapods.sh
Last active Apr 8, 2016
Uninstall All Versions of CocoaPods and Dependencies
View uninstall-cocoapods.sh
#!/bin/bash
gem uninstall cocoapods -a -x
gem uninstall cocoapods-core -a
gem uninstall cocoapods-deintegrate -a
gem uninstall cocoapods-downloader -a
gem uninstall cocoapods-plugins -a
gem uninstall cocoapods-search -a
gem uninstall cocoapods-stats -a
gem uninstall cocoapods-trunk -a
@carlossless
carlossless / rssi-to-distance.py
Last active Feb 14, 2018
A python script to find three coefficients that best fit empyrical data for the d=A*(r/t)^B+C rssi to distance conversion formula
View rssi-to-distance.py
from scipy.optimize import leastsq
import matplotlib.pyplot as plt
import numpy as np
# d=A*(r/t)^B+C
d = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,12.0,14.0,16.0,18.0,20.0,25]
r = [-20.64,-24.09,-27.55,-31.73,-35.27,-33.91,-31.36,-28.09,-32,-49.64,-52,-54.64,-55.18,-57.18,-58.64,-59.27,-72.55,-67.73,-66.65,-70,-68,-71,-74,-76,-83,-77,-83,-80,-80,-76]
t = -52.5
x = map(lambda r: r / t, r)
View keybase.md

Keybase proof

I hereby claim:

  • I am carlossless on github.
  • I am carlossless (https://keybase.io/carlossless) on keybase.
  • I have a public key ASDIyuZFuUxZrqPFmPDfiqKO-TZGi4cp6eKiKWJIKYzJ1Qo

To claim this, I am signing this object:

@carlossless
carlossless / generate-changelog.sh
Created Nov 24, 2015
A script to parse a given range of the current git repo log, find Jira issue Ids and print out links to them
View generate-changelog.sh
#!/bin/bash
COMMIT_RANGE=$TRAVIS_COMMIT_RANGE
JIRA_ISSUE_PREFIX="VI-"
JIRA_ISSUE_BASE_URL="https://mycompany.atlassian.net/browse/"
if [ -z "$COMMIT_RANGE" ]; then >&2 echo "Commit Range is Empty. Exiting."; exit 0; fi
GIT_LOG=`git log --pretty=format:'%h %ad %s | %an' --date=short "$COMMIT_RANGE" | grep -v Merge | sed -E 's/.{7} (.*)/\1/g'`
@carlossless
carlossless / ModuleA.swift
Last active Nov 19, 2015
Linker Failure when assigning a protocol with a getter for a struct property in a different framework
View ModuleA.swift
import Foundation
import ModuleB
public protocol CacheableConfiguration: Decodable {
static var fileName: String { get }
var version: Int { get } // this is what is triggering the linker fail
func object() -> AnyObject
}
You can’t perform that action at this time.