Skip to content

Instantly share code, notes, and snippets.

View blackhalt's full-sized avatar
🎯
Focusing

BlackHalt blackhalt

🎯
Focusing
View GitHub Profile
@blackhalt
blackhalt / vote.sh
Created July 1, 2022 10:18
belfi.levē
curl 'https://www.delfi.lv/misc/survey-tool/axios.php' -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: https://www.delfi.lv' -H 'Connection: keep-alive' -H 'Referer: https://www.delfi.lv/news/national/politics/delfi-aptauja-vai-esi-gatavs-jaunam-covid-19-vilnim.d?id=54506486' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'TE: trailers' --data-raw '{"question_id":"177","voting_id":43}'
@blackhalt
blackhalt / sort.sh
Created May 17, 2022 17:06
Sadala datnes pa direktorijiem
#!/bin/bash
dir_size=5000
dir_name="0"
n=$((`find . -maxdepth 1 -type f | wc -l`/$dir_size+1))
for i in `seq 1 $n`;
do
mkdir -p "$dir_name$i";
find . -maxdepth 1 -type f | head -n $dir_size | xargs -i mv "{}" "$dir_name$i"
done
#!/bin/sh
IN="$1"
filename=$(basename "${IN}")
filename="${filename%.*}"
PAGES=$(pdfinfo "$IN" | grep ^Pages: | tr -dc '0-9')
non_blank() {
for i in $(seq 1 $PAGES)
do
PERCENT=$(gs -o - -dFirstPage=${i} -dLastPage=${i} -sDEVICE=inkcov "$IN" | grep CMYK | nawk 'BEGIN { sum=0; } {sum += $1 + $2 + $3 + $4;} END { printf "%.5f\n", sum } ')
@blackhalt
blackhalt / infinite.js
Created May 10, 2022 06:05
infinite scroll
var bytefreaksTimeout;
function bytefreaksScroll() {
window.scrollBy(0,1000);
bytefreaksTimeout = setTimeout(bytefreaksScroll,100);
}
bytefreaksScroll();
//clearTimeout(bytefreaksTimeout);
@blackhalt
blackhalt / Datuma bookmaklets.js
Created December 7, 2021 10:22
Datuma bookmaklets
javascript:var d = new Date(),month = d.getMonth() + 1,date = d.getDate(),year = d.getFullYear(),area = document.getElementsByTagName("textarea")[0];area.value = year +"-"+ month +"-"+ date;void 0
@blackhalt
blackhalt / levijs.txt
Created October 26, 2021 15:28
Levijs
Pilsoniskā iniciatīva arī aicina Egilu Levitu piekrist kandidēt prezidenta amatam. Aicinājumā Saeimas deputātiem, uzsvērts, ka Egils Levits ir augstas raudzes profesionālis, par kura stāju fundamentālo vērtību jautājumos un viedokļa neatkarību nav šaubu un kurš ilgstoši ir devis ievērojamu pienesumu Latvijas valsts attīstībai, informē pilsoniskās iniciatīvas pārstāve Kristīne Tjarve.
Šo aicinājumu jau parakstījuši:
Valdis Ābols – žurnāla "Rīgas Laiks" redaktors;
Ārija Aile – pedagoģe;
Anita Andrejeva – ārste;
Georgs Andrejevs – bijušais ārlietu ministrs;
Raivis Aršauskis – fizioterapeits;
Aldis Austers – sabiedriskais darbinieks;
🇱🇻 ❤️ 🇭🇺
@blackhalt
blackhalt / gist:1ec13b652421999299f0051694ffdaf9
Last active March 26, 2021 19:59
Vikipēdijas teksta atsauču noņēmējs .js
javascript:function a(){document.body.innerHTML=document.body.innerHTML.replace(/<sup\b[^>]*>(.*?)<\/sup>/gi," ");return;};a();
@blackhalt
blackhalt / README.md
Created February 15, 2021 08:19 — forked from erkal/README.md
Random Graph Generator

Random Graph Generator

Click anywhere to generate a new random graph.

  • The nodes are colored by the number of their neighbors.
  • Nodes with higher number of neighbours are bigger.
@blackhalt
blackhalt / glitch.js
Created October 14, 2020 11:50
glitch
javascript:(function(){var t;t=function(){function t(){}return t.prototype.run=function(){return this.getImages(),this.buildCanvas(),this.process(),this.clean()},t.prototype.getImages=function(){return this.images=document.getElementsByTagName("img")},t.prototype.buildCanvas=function(){return this.canvas=document.createElement("canvas"),this.stage=this.canvas.getContext("2d"),document.body.appendChild(this.canvas),this.resizeCanvas(1,1)},t.prototype.resizeCanvas=function(t,e){return this.canvas.setAttribute("style","width: "+t+"px; height: "+e+"px; position: fixed; opacity: 0; left: -"+t+"px; top: -"+e+"px;"),this.canvas.setAttribute("width",t),this.canvas.setAttribute("height",e)},t.prototype.process=function(){var t,e,i,a,s,n;for(s=this.images,n=[],i=0,a=s.length;a>i;i++){e=s[i];try{this.image=e,this.allow(),this.setScale(),this.getImageData(),this.glitchData(),n.push(this.setData())}catch(r){t=r,n.push(console.log(t))}}return n},t.prototype.allow=function(){return this.image.setAttribute("crossOrigin","ano