Skip to content

Instantly share code, notes, and snippets.

View amorev's full-sized avatar

Anton Morev amorev

View GitHub Profile
amorev / bash
Last active February 11, 2024 01:17
Telegram backup script
View bash
# создаем один tar.bz2 архив
cd $backupDirectory
tar -cvjf $backupDirectory/archive.full.tar.bz2 $projectDirectory
split -b 40M archive.full.tar.bz2 ""
for i in `ls $backupDirectory | grep part`
amorev / bash
Last active August 31, 2023 08:44
Sending file via Telegram from terminal
View bash
echo sending $curdir/$1
curl -F chat_id=$chatId -F document=@$curdir/$1$botToken/sendDocument
# more about gist on my site —
amorev /
Last active April 2, 2023 22:22
WSL add Windows host address to /etc/hosts

This small gist will add automaticaly to hosts file and you will be able to communicate with your windows system, using as address.

After creating your wsl do next:

  1. Place at / and run chmod +x /
  2. Run visudo
  3. Add %sudo ALL=NOPASSWD: / to end of file
  4. Add sudo / at end of file /etc/profile

That's all. After first login in wsl after system start will point to your windows host

View NotionTaskObject.ts
parent: {
database_id: taskDB
properties: {
Name: {
type: "title",
title: [
type: "text",
amorev / convert.php
Last active May 24, 2021 04:25
Convert webp images to png for work in safari
View convert.php
// details -
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$fileInfo = explode('.', $entry);
$fileName = $fileInfo[0];
$fileExt = $fileInfo[1];
if ($fileExt === 'png') {
amorev / bash
Last active October 17, 2019 12:33
Wget file from Google Drive
View bash
# Change FILE_ID to ID of File in google drive.
# Change FILE_NAME to File name, which you want to use for save file
FILE_ID=FILE_ID FILE_NAME=FILE_NAME wget --load-cookies /tmp/cookies.txt "$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate '$FILE_ID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=$FILE_ID" -O $FILE_NAME && rm -rf /tmp/cookies.txt