Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
typing...

Aminadav Glickshtein Aminadav

💭
typing...
View GitHub Profile
View auto-archive.js
function AutoArchiveLabelOld() {
Logger.log('asdssss')
var AutoArchiveLabel=GmailApp.getUserLabelByName("Automation/AutoArchive")
Logger.log('asd')
Logger.log(AutoArchiveLabel)
var AutoArchivedLabel=GmailApp.getUserLabelByName("Automation/AutoArchived")
var threads=AutoArchiveLabel.getThreads()
for (var i=0;i<threads.length;i++){
var thread=threads[i]
Logger.log('a=' + thread.getLastMessageDate().valueOf())
@Aminadav
Aminadav / auto-forward.js
Created Feb 10, 2020
App script auto forward email
View auto-forward.js
function myFunction() {
Logger.log("start")
var labels=GmailApp.getUserLabels()
labels[0].getName()
var forwardedLabel=GmailApp.getUserLabelByName("forwarded")
for(var i =0 ;i<labels.length;i++){
var name=labels[i].getName()
if (name.match(/fwd:/)) {
Logger.log("label:" + name)
var to=name.match(/fwd:(.*)/)[1]
@Aminadav
Aminadav / FaceDetection.js
Created Jan 13, 2020
Face Detection (face_detection + crop using imagemagick + batch using xargs)
View FaceDetection.js
// Using: ls yadani | xargs -L 1 -I {} node extract yadani/{} cropped/{}
var cp=require("child_process")
var x=new Array(...process.argv)
var target=x.pop().replace(/ /g,'\\ ')
var src=x.pop().replace(/ /g,'\\ ')
console.log({target,src})
var res=cp.execSync(`face_detection ${src}`).toString().trim()
var a=res.split(',')
View gist:7eb7c6c079ca8eadcc094927d6077c2a
var list=document.querySelector('.copyable-area').querySelectorAll('.X7YrQ')
// var ar=[];
for(let i=0;i<list.length;i++) {
var friend=list[i]
var phone=friend.querySelector('[tabindex] > div >div:nth-child(2) > div').textContent
.replace('+972','0').replace(/[ \-]/g,'')
try{
var image=friend.querySelector('img').src
}
View extract-ws-friends.js
var list=document.querySelector('.copyable-area').querySelectorAll('.X7YrQ')
var ar=[];
for(let i=0;i<list.length;i++) {
var friend=list[i]
var phone=friend.querySelector('[tabindex] > div >div:nth-child(2) > div').textContent
.replace('+972','0').replace(/[ \-]/g,'')
try{
var image=friend.querySelector('img').src
}
View extract-fb-friend.js
var list= document.querySelectorAll('[data-testid="friend_list_item"]')
var ar=[];
for(let i=0;i<list.length;i++) {
friend=list[i]
var link=friend.querySelector('a[href*=facebook]').href.match(/^[^?]*/)[0]
var image=friend.querySelector('[aria-label]').src
var name=friend.querySelector('[aria-label]').getAttribute('aria-label')
ar.push({link,image,name})
}
copy(JSON.stringify(ar))
View autoscroll.js
var y=0
var i=0
var done=false;
var last
function s(){
if(done) return;
var current=document.scrollingElement.scrollTop
if(last==current) {
i++
} else {
View z1.html
<script>
x=[
'https://en.wikipedia.org/wiki/Israel',
'https://en.wikipedia.org/wiki/United_states'
]
y=x[parseInt(Math.random()*x.length)]
location.href=y;
</script>
View zevik.html
<script>
x=location.hash.slice(1).split(',');
y=x[parseInt(Math.random()*x.length)]
location.href=y;
</script>
View stylebot import file
{"web.whatsapp.com":{"_enabled":true,"_rules":{"div#pane-side":{"zoom":"0.5"},"div#pane-side span._1wjpf":{"font-size":"28px","line-height":"33px","margin-top":"20px"},"div#pane-side span._3T2VG":{"font-size":"25px","line-height":"25px"},"div#pane-side span._2ArBI":{},"div#pane-side span._2_LEW":{"display":"none"},"header._3AwwN":{"background":"#ffe000"},"header._3auIg":{"background":"#ffe000"}}},"www.google.co.il":{"_enabled":true,"_rules":{".sfbgg":{"background":"#ffe600"},"div#hdtbSum":{"background":"#ffe600"},".b0KoTc.B4GxFc":{"background":"#ffe600"},"div#fbar":{"background":"#ffe600","border-top":"none"},".fbar.b2hzT":{"border":"none"}}},"en.wikipedia.org":{"_enabled":true,"_rules":{"#mw-panel":{"background-color":"#ffe600"}}}}