Skip to content

Instantly share code, notes, and snippets.

View achembarpu's full-sized avatar
:bowtie:
Building Cool Things.

Arvind Chembarpu achembarpu

:bowtie:
Building Cool Things.
View GitHub Profile
@achembarpu
achembarpu / blue.md
Last active May 17, 2023 01:45
AptX & AAC on MacOS Bluetooth

AptX & AAC on MacOS Bluetooth

AptX works on Catalina (10.15.4), tested with the Sony WH-1000XM3.

  1. Run the following commands in terminal: (Bluetooth Explorer is no longer needed)
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true
sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true
  1. Reboot both your system and headphones.
@achembarpu
achembarpu / pr.md
Created February 6, 2020 20:37 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@achembarpu
achembarpu / Select-StringAdvanced.ps1
Last active February 1, 2017 07:59
A simple powershell clone of the unix `grep` command
function Select-StringAdvanced {
Param (
[Parameter(Mandatory=$True)][string]$Pattern,
[Alias("f")][string[]]$Files,
[Alias("a")][int]$AfterContext = 0,
[Alias("b")][int]$BeforeContext = 0,
[Alias("x")][int]$Context = 0,
[string[]]$Include,
[string[]]$Exclude,
[Alias("c")][switch]$Count = $False,
@achembarpu
achembarpu / Out-FileUTF8.ps1
Last active February 1, 2017 05:05
A simple powershell pipeline function to save streaming output to file with non-BOM UTF-8 encoding.
function Out-FileUTF8 {
Param (
[Parameter(Mandatory=$True)][string]$Path,
[switch]$Append,
[Parameter(ValueFromPipeline)]$Input
)
[Environment]::CurrentDirectory = $pwd
$absPath = [IO.Path]::GetFullPath($Path)
$sw = New-Object IO.StreamWriter $absPath, $Append
Try {
@achembarpu
achembarpu / Rename-Items.ps1
Last active February 1, 2017 08:00
A simple bulk pattern-matching file `rename` function for powershell
function Rename-Items {
param(
[alias("p")][string]$Path = $pwd,
[Parameter(Mandatory=$true)][string]$OldPattern,
[string]$NewPattern = ""
)
Get-ChildItem $Path | Rename-Item -NewName {
$_.Name -replace $OldPattern, $NewPattern
}
}; Set-Alias rename Rename-Items
@achembarpu
achembarpu / Register-Python.ps1
Last active February 1, 2017 08:00
A simple PowerShell function to add local python virtualenv to env PATH
function Register-Python {
.\venv\Scripts\activate.ps1
}; Set-Alias regpy Register-Python
@achembarpu
achembarpu / SyncScroll.js
Last active February 1, 2017 08:03
A simple vanilla javascript implementation of synchronized scrolling between two html elements
function debounce (func, wait, immediate) {
var timeout;
return function () {
var context = this, args = arguments;
var later = function () {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
@achembarpu
achembarpu / List-Items.ps1
Last active February 1, 2017 08:02
A simple powershell clone of the unix `ls` command
function List-Items {
param(
[alias("p")][string]$Path = $pwd,
[alias("a")][switch]$All = $false,
[alias("l")][switch]$Long = $false,
[Parameter(ValueFromRemainingArguments = $true)]$GCIArgs
)
$children = $(Get-ChildItem $Path -Force:$All @GCIArgs)
if ($Long) {
@achembarpu
achembarpu / Which-Command.ps1
Last active February 4, 2017 17:01
A simple powershell clone of the unix `which` command
function Which-Command {
Param (
[Parameter(Mandatory=$True)][string]$Command,
[Alias("v")][Switch]$Long = $False
)
$commandDetails = Get-Command $Command
If ($Long) {
$commandDetails
} Else {
@achembarpu
achembarpu / Link-Paths.ps1
Last active July 3, 2017 21:04
A simple powershell clone of the unix `ln` command