Skip to content

Instantly share code, notes, and snippets.

@faniska
faniska / nginx_ln_domain.sh
Created May 31, 2022 06:24
Nginx: create symlink sites-available -> sites-enabled
ln -s /etc/nginx/sites-available/domain.conf /etc/nginx/sites-enabled/domain.conf
@faniska
faniska / enable_eco_mode.bash
Last active December 4, 2022 16:29
Enabling ECO Mode for MSI Modern 14A laptop to dicrease fan RPM
#!/bin/bash
sudo modprobe ec_sys write_support=1
echo -n -e "\xc2" | sudo dd of="/sys/kernel/debug/ec/ec0/io" bs=1 count=1 conv=notrunc seek=242
@faniska
faniska / autostart.sh
Last active August 25, 2021 11:22
Autostart mining
#!/bin/sh
sleep 10
export DISPLAY=:0
/usr/bin/xset -dpms
/usr/bin/xset s off
sudo /usr/bin/nvidia-smi -pm 1
sudo /usr/bin/nvidia-smi -pl 90
@faniska
faniska / site_pinger.php
Created January 25, 2019 12:22
Site Pinger
<?php
function get_url($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "PC Tester Curl");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
@faniska
faniska / 5min_gnome.sh
Last active November 21, 2017 11:35
Notify and lock screen on Ubuntu Linux
#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)"
/usr/bin/notify-send -i face-wink "Пятиминутка" "Сделай паузу!"
/bin/sleep 2
loginctl lock-session 3
@faniska
faniska / wkhtmltopdf.sh
Last active March 26, 2025 02:11
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@faniska
faniska / time_planner.py
Created September 20, 2017 08:03
Time Planner: Calculating end date or task duration with given working days, hours, holidays eth
# -*- coding: utf-8 -*-
import datetime
from dateutil import parser as dt_parser
class TimePlanner:
holidays = None
weekend = None
working_hours = None