Skip to content

Instantly share code, notes, and snippets.

@vhsu
vhsu / GetAdsByID.js
Created January 28, 2018 15:13
Adwords Script : Get Ads By ID
function main() {
var inc=0;
var adGroupSelector = AdWordsApp
.adGroups()
.forDateRange("ALL_TIME")
.withCondition("Clicks > 10")
.orderBy("Clicks DESC");
var adGroupIterator = adGroupSelector.get();
while (adGroupIterator.hasNext()) {
@vhsu
vhsu / Suisseograntsscript.js
Last active February 24, 2024 23:14
Google Grants Report Google Ads Script By Suisseo (Single Account Script)
/**********************************************************************************************************************
This Google Ads script checks a single Google grants account for mandatory requirements and logs the results in a Google Spreadsheet
UPDATED : 23.02.2024 : Updated to v16 api + updated the adgroup counting to consider DSA (thanks Frederique Boitelle for reporting this issue).
Author : Suisseo (Vincent Hsu)
More Info : https://www.suisseo.ch/en/blog/google-ad-grants-script/
1. Detect if Campaigns are set to 'maximize conversion' to allow bids higher that 2 dollars
2. Detect if each Campaign has at least 2 active ad groups with at least 2 active text (or at least 1 RSA)
3. Detect if each account has at least 2 active Sitelinks
4. Detect if each campaign has geo-targeting .
@vhsu
vhsu / Google Ad Authorized Single Keywords.txt
Created April 18, 2018 17:55
Google Ad Authorized Single Keywords 16.04.2018
donere da 4/16/2018
donation da 4/16/2018
ngo da 4/16/2018
ngo'er da 4/16/2018
almennyttig da 4/16/2018
nonprofitorganisationer da 4/16/2018
velgørenhedsorganisationer da 4/16/2018
hjemløs da 4/16/2018
hjemløshed da 4/16/2018
MOOC da 4/16/2018
@vhsu
vhsu / pystanInstall.txt
Last active May 26, 2018 10:47
Pystan Windows Reinstall
1 . Open CMD.exe as ADMIN
2. Install Chocolatery : @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
https://chocolatey.org/install
3. Update Python : choco install python --pre
https://chocolatey.org/packages/python
4. Install Anaconda : https://www.anaconda.com/download/
@vhsu
vhsu / gist:ea1e832262265b93d87528819caa1062
Last active May 25, 2018 12:41 — forked from alisterlf/gist:3490957
JAVASCRIPT:Remove Accents
//Lowercase Only Version
function RemoveAccents(strAccents) {
var strAccents = strAccents.split('');
var strAccentsOut = new Array();
var strAccentsLen = strAccents.length;
var accents = 'àáâãäåòóôõöøèéêëðçÐìíîïùúûüñšÿýž';
var accentsOut = "aaaaaaooooooeeeeecdiiiiuuuunsyyz";
for (var y = 0; y < strAccentsLen; y++) {
if (accents.indexOf(strAccents[y]) != -1) {
strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1);
@vhsu
vhsu / Google App script - Post a Google Form.js
Created May 28, 2018 16:52
Submit a Google Form from App Script (Google Spreadsheet)
//https://stackoverflow.com/questions/20410497/use-app-scripts-to-open-form-and-make-a-selection?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
// Simulate POST to form
function sendHttpPost() {
// Copy the entire URL from <form action>
var formAction = "https://docs.google.com/forms/d/e/KEY/formResponse";
var payload = {
"entry.888888888": "6689898", // Number
@vhsu
vhsu / clasp
Created June 12, 2018 16:17
App Scripts Commands
https://github.com/google/clasp
npm install @google/clasp -g
clasp login
clasp clone <project id> (you should navigate in the correct file : dir (ls), cd) use clasp list to find some ids
clasp push
clasp pull
clasp open <project id> ( if not already defined)
Create an immutable version op project
@vhsu
vhsu / consolelogadd.js
Last active July 8, 2018 06:54
Javascript debugging : Add console logs in functions in the global namespace
//Author Wayne Burkett
//https://stackoverflow.com/questions/5033836/adding-console-log-to-every-function-automatically#5034657
//Add console log to all existing function existing in 5he global namespace at the time of execution
function augment(withFn) {
var name, fn;
for (name in window) {
fn = window[name];
if (typeof fn === 'function') {
window[name] = (function(name, fn) {
@vhsu
vhsu / file2Array.java
Created July 30, 2018 16:44
Convert File to Array
//Convert a file to an array (each line /n as an element)
public String[] UrlFileToArray(String fileurl){
ArrayList inputFile =readFile(fileurl);
String urlArray[] = (String[])inputFile.toArray(new String[inputFile.size()]);
return urlArray;
}
@vhsu
vhsu / combiLoopOptimizer.js
Created October 31, 2018 18:47
combiLoopOptimizer
//This is used in findBalancedSets function, to reduce processing time for large sets of combinations
function combiLoopOptimizer(combinationsR, playerNames) {
var start = 0;
var skipRanges = [];
skipRanges.length = combinationsR[0].length;
for (var i = playerNames.length; i >= 0; i--) {
//size of range to skip
var temp = Math.floor(getTotalCombinations(i - 1, teamsize - 1));
//start of range to skip