Skip to content

Instantly share code, notes, and snippets.

@javikalsan
javikalsan / worker.js
Created January 24, 2022 22:44 — forked from tobiaslins/worker.js
Notion Custom Domain using Cloudflare Workers + Splitbee Analytics
const MY_DOMAIN = "help.splitbee.io"
const START_PAGE = "https://www.notion.so/splitbee/Help-Center-bbf26e2b70574901b9c98e5d11e449de"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, POST,PUT, OPTIONS",
const MY_DOMAIN = "fka.dev"
const NOTION_MAIL = "fatihkadirakin@aof.anadolu.edu.tr"
const START_PAGE = "https://www.notion.so/fkadev/fka-dev-0606b67bc0f14660992362682d6f7eda"
const DISQUS_SHORTNAME = "fkadev"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
@javikalsan
javikalsan / ffmpeg-multi-instances-xargs.md
Created October 10, 2020 22:58 — forked from Brainiarc7/ffmpeg-multi-instances-xargs.md
This gist will show you how to launch multiple ffmpeg instances with xargs, very useful for NVIDIA NVENC based encoding where standard GPUs limit the maximum simultaneous encode sessions to two.

Spawning multiple ffmpeg processes with xargs:

On standard NVIDIA GPUs (Not the Quadros and Tesla lines), NVENC encodes are limited to two simultaneous sessions. The sample below illustrates how to pass a list of AVI files to ffmpeg and encode them to HEVC on two encode sessions:

$ find Videos/ -type f -name \*.avi -print | sed 's/.avi$//' |\
  xargs -n 1 -I@ -P 2 ffmpeg -i "@.avi" -c:a aac -c:v hevc_nvenc "@.mp4"

This will find all files with the ending .avi in the directory Videos/ and transcode them into HEVC/H265+AAC files with the ending .mp4. The noteworthy part here is the -P 2 to xargs, which starts up to two processes in parallel.

#!/bin/bash
# Start the qgis dockerized dev version
# qgis 2019 workshop: Data Visualization and Cartography with QGIS
# Allow connections from any host
xhost +
# Start docker container with plugins path and qgis projects path mapped
# to persist and load existing qgis plugins
docker run --rm -it --name qgis \
-v /tmp/.X11-unix:/tmp/.X11-unix \
@javikalsan
javikalsan / youtube-dl
Created July 23, 2017 06:54
youtube-dl download as mp3 example
youtube-dl /usr/local/bin/youtube-dl -i --extract-audio --audio-format mp3 --audio-quality 512K --yes-playlist --playlist-start 1 --playlist-end 46 https://www.youtube.com/playlist?list={{ PLAYLIST ID }}
@javikalsan
javikalsan / screenCastWithAvconv
Created November 17, 2016 17:44
command for record desktop on linux system
avconv -f alsa -i hw:0 -f x11grab -r 25 -s 1680x1050 -i :0.0 -vcodec libx264 -threads 4 output-file2.avi
@javikalsan
javikalsan / timelapse_avconv
Last active October 7, 2016 17:32
Timelapse with avconv
#!/bin/bash
# rename photos
a=1
for i in *.JPG; do
new=$(printf "%04d.JPG" ${a}) #04 pad to length of 4
mv ${i} ${new}
let a=a+1
done
@javikalsan
javikalsan / solid.principles
Created January 12, 2016 22:55
SOLID principles abstract
S-Responsabilidad simple (Single responsibility)
un objeto solo debería tener una única responsabilidad
O-Abierto/Cerrado (Open/Closed)
Las "entidades de software … deben estar abiertas para su extensión, pero cerradas para su modificación".
L-Sustitucion Liskov (Liskov substitution)
Los "objetos de un programa deberían ser reemplazables por instancias de sus subtipos sin alterar el correcto funcionamiento del programa"
I-Segregacion del interface (Interface segregation)
@javikalsan
javikalsan / vim.cheatsheet
Last active December 8, 2015 21:38
Vim Cheatsheet
# ESC mode
i => insert
a => add/insert at next word/space
o => new bottom line and insert
O => new up line and insert
w => next word
b => previous word
dd => cut line
yy => copy line
@javikalsan
javikalsan / mongodb.twitter
Last active July 23, 2016 19:58
Mongodb queries for mine twitter collections
# general #
use database; db.createCollection( 'collection' ); # create database with name database with empty collection named collection
use database; db.runCommand( { dropDatabase: 1 } ); or use database; db.dropDatabase(); # remove database
db.twits.remove(); # empty collection
db.twits.find().count(); # count all twits in the collection
mongodump -d database -c collection -o collection.dump # dump entire collection
mongorestore -d database -c collection myfoo.dump/database/collection.bson # restore dumped collection
mongoexport --db database --collection collection -q "{}{ "_id":0, "date":1, "lon":1, "lat":1 }" --csv -f "date,lon,lat" --out results_query.csv # export to CSV a query
# basic search and display #