View facebook-ad-insights.gs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.benlcollins.com/apps-script/api-tutorial-for-beginners/ | |
function main() { | |
let accessToken = "YOUR_ACCESS_TOKEN" | |
let fields = "account_id,account_name,date_start,date_stop,impressions,spend" | |
let accountIds = getAccountIds(accessToken) | |
let jsonData = getAdInsights(accountIds, fields, accessToken) | |
let sheet = SpreadsheetApp.getActiveSheet() | |
let dataKeys = Object.keys(jsonData[0]) | |
let dataArray = convertToArray(dataKeys, jsonData) | |
dataArray.unshift(dataKeys) |
View kraken-avg-cost.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import base64 | |
import hashlib | |
import hmac | |
import json | |
import os | |
import requests | |
import time | |
import urllib.parse |
View locker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USAGE_TEXT="Usage: locker.sh <command> target | |
Commands: | |
lock Expects target to be a directory. This directory will be compressed | |
with a password using 7z removing the original directory afterwards. | |
unlock Expects target to be a 7z compressed file. Unlocks the given |
View nvim-update-to-tag.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
TAG="stable" | |
else | |
TAG=$1 | |
fi | |
TMP_FILE=nvim-macos.tar.gz |
View log4j2-test.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For use when you need trace level logs | |
status = error | |
name = PropertiesConfig | |
filters = threshold | |
filter.threshold.type = ThresholdFilter | |
filter.threshold.level = trace | |
appenders = console |
View useful-vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete till end of line | |
dt$ |
View sed-create-tests.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find main | grep -P 'Rule.java$' > testfile | |
sed 's/main/test/g' testfile | sed 's/Rule\.java/RuleTest\.java/g' > final | |
cat final | xargs -L 1 mkdir -p |
View .bash_aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias pcat='pygmentize -g' | |
alias chrome='google-chrome-stable' | |
alias gfr='git svn fetch; git svn rebase' | |
alias work='cd ~/workspace/' | |
alias home='cd ~' | |
alias bprops='vim /etc/cwan/titan/basic.properties' | |
alias bpropsd2='vim /etc/cwan/titan/d2/basic.properties' | |
alias rm='rm -v' | |
alias mv='mv -v' | |
alias cp='cp -v' |
View intellij-java-code-style.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<code_scheme name="Titan (hand entered)" version="173"> | |
<option name="SOFT_MARGINS" value="120" /> | |
<JavaCodeStyleSettings> | |
<option name="SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS" value="false" /> | |
<option name="BLANK_LINES_AROUND_INITIALIZER" value="0" /> | |
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> | |
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> | |
</JavaCodeStyleSettings> | |
<SqlCodeStyleSettings version="2"> | |
<option name="ALIAS_CASE" value="1" /> |
View NullSafe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static boolean safeEquals(Integer first, Integer second) { | |
return (first == null && second == null) || (first != null && first.equals(second)); | |
} | |
private static boolean safeContains(String str, String substr) { | |
return str != null && str.contains(substr); | |
} | |
private static <K> List<K> safe(List<K> list) { | |
return list != null ? list : Collections.EMPTY_LIST; |
NewerOlder