Skip to content

Instantly share code, notes, and snippets.

@yuriploc
yuriploc / chromecast.sh
Last active May 20, 2016 15:53 — forked from victorono/chromecast.sh
Using Google Chromecast from Fedora 20
cat /proc/sys/net/ipv4/ip_local_port_range
firewall-cmd --permanent --add-port=32768-61000/udp
firewall-cmd --reload
firewall-cmd --permanent --zone=home --add-port=32768-61000/udp
# if you use iptables..
# iptables -A INPUT -s 192.168.0.0/24 -p udp -m udp --dport 32768:61000 -j ACCEPT
defaults
log global
maxconn 4096
mode http
option httplog
option dontlognull
option forwardfor
option http-server-close
timeout connect 5000
timeout client 50000
lsblk # see partitions to umount
umount /dev/sdX # better to umount all partitions from the destination drive
sudo dd if=/path/to/iso/image.iso of=/dev/sdX bs=4M oflag=direct,sync status=progress
dosfslabel /dev/sdX LIVE
@yuriploc
yuriploc / upgrade_fedora
Last active December 7, 2020 02:57
upgrading Fedora using dnf system-upgrade
// in case you have VirtualBox and kmod-vbx, akmod-vbx, remove them
sudo dnf distro-sync --allowerasing
sudo dnf upgrade --refresh -y
sudo dnf install dnf-plugin-system-upgrade -y
sudo dnf system-upgrade download --releasever=NUM
sudo dnf system-upgrade reboot
sudo dnf remove -y google-chrome-\* && sudo dnf install -y google-chrome-stable
@yuriploc
yuriploc / java_where_are_you
Created August 8, 2016 13:37
Java, where are you?
ls -alSh /usr/bin/ | grep java
$(readlink -f /usr/bin/java | sed "s:bin/java::")
@yuriploc
yuriploc / normalizePort.js
Created August 5, 2017 22:49
normalizePort, from expressjs
function normalizePort(val) {
const port = parseInt(val, 10)
if (isNaN(port)) {
return val
}
if (port >= 0) {
return port
}
@yuriploc
yuriploc / vim.md
Created August 9, 2017 12:15
From Atom to Vim

Installation

  1. vim/gvim
  2. vundle
  3. ale

Configuration

  1. config .vimrc to use vundle based on joelxr vimrc file
@yuriploc
yuriploc / get_set.js
Created August 31, 2017 19:50
which one? and why?
// #1 - getter & setter
service.getPriceUpdatedAt = () => store.priceUpdatedAt
service.setPriceUpdatedAt = (tmstmp) => {
store.priceUpdatedAt = parseInt(tmstmp)
}
// #2 - 2in1
service.priceUpdatedAt = (tmstmp) => {
if (!tmstmp) return store.priceUpdatedAt
@yuriploc
yuriploc / addswap.sh
Last active July 12, 2019 13:13
add 2GB of swap memory
dd if=/dev/zero of=/var/swap bs=1k count=2048k
mkswap /var/swap
swapon /var/swap
echo '/var/swap swap swap default 0 0' >> /etc/fstab
@yuriploc
yuriploc / customError.js
Created August 27, 2018 14:16
Custom Error
function CustomError(message, name='CustomError', code=500) {
const error = Error.call(this, message);
this.name = name;
this.code = code,
this.message = error.message;
this.stack = error.stack;
}
CustomError.prototype = Object.create(Error.prototype);