Skip to content

Instantly share code, notes, and snippets.

View thelebster's full-sized avatar
:octocat:
Do nothing, it is ok.

Anton Lebedev thelebster

:octocat:
Do nothing, it is ok.
View GitHub Profile
@thelebster
thelebster / clean.sh
Created December 5, 2022 05:49 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@thelebster
thelebster / aws-point-domain
Created November 17, 2022 06:49 — forked from EmadAdly/aws-point-domain
Setup bitnami lamp stack point domain and vhost
## Point Domain to Amazon Web Services (AWS) EC2 Instance
1. Open the Amazon Route 53 console at [https://console.aws.amazon.com/route53/](https://console.aws.amazon.com/route53/).
2. If you are new to Amazon Route 53, you see a welcome page; choose **Get Started Now** for **DNS Management**. Otherwise, choose **Hosted Zones** in the navigation pane.
3. Choose **Create Hosted Zone**.
4. For **Domain Name**, type your domain name.
5. Choose **Create**.
6. Click the Hosted Zone, edit record set.
@thelebster
thelebster / script.js
Created November 9, 2022 18:29 — forked from ricardozea/script.js
Smooth scroll to top of page (Improved!)
window.scrollTo({top: 0, behavior: "smooth"});
@thelebster
thelebster / jq-select-by-length.sh-session
Created September 13, 2022 18:33 — forked from jimjh/jq-select-by-length.sh-session
jq - select objects based on lengths of arrays
# objects with at least one widget and at least one user
$ cat part-r-00000 | jq 'select((.widgets | length) > 0 and (.users | length) > 0)'
@thelebster
thelebster / atob.js
Last active September 13, 2022 17:55 — forked from jmshal/atob.js
Node.js ponyfill for atob and btoa encoding functions
module.exports = function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
@thelebster
thelebster / submodules.sh
Created August 16, 2022 10:51 — forked from andrezrv/submodules.sh
Using Git submodules.
# CREATE: On the root folder of a Git repository:
$ git submodule add [email protected]:nicethemes/<repo>.git location/of/submodule
# Cloning a repo that contains submodules:
$ git clone --recursive [email protected]:nicethemes/<repo>.git location/of/repo
# Or:
$ git clone [email protected]:nicethemes/<repo>.git location/of/repo
$ git submodule init
$ git submodule update
@thelebster
thelebster / notion2blog.js
Created October 2, 2021 08:19 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@thelebster
thelebster / ffmpeg_mkv_mp4_conversion.md
Created July 21, 2021 16:03 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@thelebster
thelebster / jq-cheetsheet.md
Created February 7, 2021 20:30 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@thelebster
thelebster / letsencrypt.py
Last active January 23, 2021 21:22 — forked from gpjt/letsencrypt.py
Sample acme code to get a certificate from Let's Encrypt #letsencrypt
# There's a lack of sample code for acme/Let's Encrypt out there, and
# this is an attempt to at least slightly remedy that. It's the result
# of my first day's hacking on this stuff, so almost certainly contains
# errors and oversights.
#
# It's not designed to be specifically useful if what you want is
# just a cert -- certbot or dehydrated are better for that. It is sample
# code for people who are building automated systems to deal with large
# numbers of Let's Encrypt certificates to play with.
#