Skip to content

Instantly share code, notes, and snippets.

View cdbattags's full-sized avatar
🔥
hustlin'

Christian Battaglia cdbattags

🔥
hustlin'
View GitHub Profile
@cdbattags
cdbattags / Code.gs
Created October 7, 2022 01:41
Google Sheets "Export to JSON"
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@cdbattags
cdbattags / load-verify-jwe.t
Created January 20, 2021 20:37
openresty json string comparison
use Test::Nginx::Socket::Lua;
repeat_each(2);
plan tests => repeat_each() * (3 * blocks());
our $HttpConfig = <<'_EOC_';
lua_package_path 'lib/?.lua;;';
_EOC_
@cdbattags
cdbattags / set-audio-output.scpt
Created April 15, 2020 12:55
two AppleScripts: automating setting display orientation and setting audio output
set codec to "CODEC"
set headphones to "headphones"
tell application "System Preferences" to quit
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal anchor "Output" of pane id "com.apple.preference.sound"
end tell
@cdbattags
cdbattags / set-audio-output.scpt
Created February 7, 2020 17:17
Applescript for setting proper sound output device
set codec to "CODEC"
set headphones to "headphones"
tell application "System Preferences" to quit
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal anchor "Output" of pane id "com.apple.preference.sound"
end tell
@cdbattags
cdbattags / angular-1-injection.js
Created August 2, 2019 19:44
Angular 1.x Injected
const inject = (element, state, template) => {
const injected = angular.element(element).injector()
injected.invoke(['$compile', '$rootScope', ($compile, $rootScope) => {
scope = angular.extend($rootScope.$new(), { $ctrl: state });
el.replaceWith($compile(template)(scope));
}]);
}
@cdbattags
cdbattags / angular-app.js
Last active August 2, 2019 19:24
Angular 1.x with Redux
import angular from 'angular';
import uiRouter from 'angular-ui-router';
import ngRedux from 'ng-redux';
import AppComponent from './app.component';
import NavigationComponent from './components/navigation/navigation';
import HomeComponent from './containers/home/home';
// import the root reducer from reducers folder
@cdbattags
cdbattags / blocklist-gen.sh
Created February 21, 2019 23:05
blocklist for transmission
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| sed "s/\&amp;/\&/g" \
| sed "s/http/\"http/g" \
| sed "s/gz/gz\"/g" \
| xargs curl -L \
| gunzip \
@cdbattags
cdbattags / getBlockLists.sh
Created September 21, 2016 01:34 — forked from johntyree/getBlockLists.sh
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@cdbattags
cdbattags / keybase.md
Created July 15, 2016 12:32
keybase.io proof

Keybase proof

I hereby claim:

  • I am cdbattags on github.
  • I am cdbattags (https://keybase.io/cdbattags) on keybase.
  • I have a public key whose fingerprint is E1AF 534B EAD0 42DF 18D6 6CD2 7C45 0A7E A29B 9B1D

To claim this, I am signing this object: