Skip to content

Instantly share code, notes, and snippets.

View vitalibondar's full-sized avatar

Vitali Bondar vitalibondar

View GitHub Profile
@i386net
i386net / scrapbox-new-card.js
Last active July 27, 2021 09:40
for Scrapbox.io | UA localization
const diffDate = (date, diff) => {
// date: '1993-09-11'
// diff: +1, -1
console.log('input', date);
console.log('diff', diff);
date.setDate(date.getDate() + diff);
console.log('output', date);
const a = [
date.getFullYear(),
('00' + (1 + date.getMonth())).slice(-2),
<?php
date_default_timezone_set('Asia/Tokyo');
$url = "https://scrapbox.io/api/pages/yoneda/?limit=3";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$results = curl_exec($curl);
curl_close($curl);
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@jburon
jburon / ocrpdf.sh
Last active January 23, 2018 16:42 — forked from wcaleb/ocrpdf.sh
Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable
#!/bin/sh
# Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable.
# Hacked together using tips from these websites:
# http://www.jlaundry.com/2012/ocr-a-scanned-pdf-with-tesseract/
# http://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line
# Dependencies: pdftk, tesseract, imagemagick, hocr2pdf
cp $1 $1.bak
pdftk $1 burst output tesspage_%02d.pdf
@idvoretskyi
idvoretskyi / linux_tips&tricks.sh
Last active April 1, 2021 11:46
Linux Tips&tricks.sh
########### Benchmark
wget -qO- bench.sh | bash
curl -Lso- bench.sh | bash
########### User management
# allow superuser access without password
@ivanoats
ivanoats / sublime-draft.md
Last active December 28, 2021 07:10
sublime draft

Link Bash to Sublime

On the Mac - run this command in Terminal

Sublime Text 2:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Sublime Text 3:

@wcaleb
wcaleb / ocrpdf.sh
Created November 6, 2013 14:41
Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable
#!/bin/sh
# Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable.
# Hacked together using tips from these websites:
# http://www.jlaundry.com/2012/ocr-a-scanned-pdf-with-tesseract/
# http://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line
# Dependencies: pdftk, tesseract, imagemagick, enscript, ps2pdf
# Would be nice to use hocr2pdf instead so that the text lines up with the PDF image.
# http://www.exactcode.com/site/open_source/exactimage/hocr2pdf/