Skip to content

Instantly share code, notes, and snippets.

Avatar

Dariel Dato-on oddrationale

View GitHub Profile
View Config.ini
; bug.n - tiling window management
; @version 9.0.2
;; Status bar
;Config_showBar=1
Config_horizontalBarPos=-350
Config_verticalBarPos=tray
Config_barWidth=280
Config_singleRowBar=0
;Config_spaciousBar=0
@oddrationale
oddrationale / search_images_bing.md
Created Sep 6, 2020
Download more than 150 images using Bing Search API
View search_images_bing.md

HOWTO:Download more than 150 images using Bing Search API

From this post on the fastai forums, we discussed the best way to get more than 150 images from the Bing Search API. We came up with a solution to modify the utils.py as follows:

# +
# pip install azure-cognitiveservices-search-imagesearch

import logging
View gi2ds.js
(function(e, s) {
e.src = s;
e.onload = function() {
jQuery.noConflict();
jQuery('<style type="text/css"> .remove { opacity:0.3;}\n .urlmodal {padding: 10px; background-color: #eee; position: fixed; bottom: 0; right: 0; height: 200px; width: 300px; z-index: 1000;} .urlmodal textarea {width: 100%; height: 140px;}</style>').appendTo('head');
jQuery('<div class="urlmodal"><h3>Let\'s create a dataset</h3><textarea>Scoll all the way down\nClick "Show more images"\nScroll more\nClick on the images you want to remove from the dataset\nThe urls will appear in this box for you to copy.</textarea></div>').appendTo('body');
jQuery('.urlmodal textarea').focus(function() {updateUrls(); setTimeout(selectText, 100)}).mouseup(function() {return false;});
jQuery(window).scroll(function() {
toggle();
updateUrls();
View scrapeImageUrls.js
// Google Images
var urls=Array.from(document.querySelectorAll(".rg_i")).map(el=>el.hasAttribute("data-src")?el.getAttribute("data-src"):el.getAttribute("data-iurl")).filter(l=>l!=null).join("\n");
var a = document.createElement("a");a.download = "filename.txt";a.href = "data:text/csv;charset=utf-8,"+urls;a.click();
// DuckDuckGo Images (uses Bing)
var urls=Array.from(document.querySelectorAll(".tile--img__img")).map(el=>el.hasAttribute("data-src")?el.getAttribute("src"):el.getAttribute("data-src")).filter(l=>l!=null).map(l=>"https:"+l).join("\n");
var a = document.createElement("a");a.download = "filename.txt";a.href = "data:text/csv;charset=utf-8,"+urls;a.click();
// Bing Images
var urls=Array.from(document.querySelectorAll(".mimg")).map(el=>el.hasAttribute("src")?el.getAttribute("src"):null).filter(l=>l!=null&&l.startsWith("http")).join("\n");
@oddrationale
oddrationale / KittySolarizedDark
Created Jan 25, 2018
Kitty Solarized Dark Color Scheme
View KittySolarizedDark
Colour0\131,148,150\
Colour1\147,161,161\
Colour2\0,43,54\
Colour3\7,54,66\
Colour4\0,43,54\
Colour5\238,232,213\
Colour6\7,54,66\
Colour7\0,43,54\
Colour8\220,50,47\
Colour9\203,75,22\
View InstallNodeJS.md

Easiest way to install nodejs on Ubuntu

Installs the latest version of nodejs/iojs

curl https://raw.githubusercontent.com/isaacs/nave/master/nave.sh | sudo bash -s -- usemain latest

No need to add PPA repo.