Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / custom_sort_python_list
Created September 9, 2022 13:49
Sort python list containing tuples with dict
#!/usr/bin/env python
class CustomCompare(object):
def __init__(self, obj, order):
self.obj = obj
self.order = order
def __lt__(self, other):
return self._index_of(self.obj) < self._index_of(other.obj)
@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 / .gitlab-ci.yml
Created January 17, 2023 13:30 — forked from andrasKelle/.gitlab-ci.yml
Example CI configuration for generated pipelines
stages:
- child-pipeline-generator
- child-pipeline-trigger
generate-child-pipeline:
stage: child-pipeline-generator
image: python:3.9-slim-buster
script:
- python3 main.py
artifacts:
@faniska
faniska / fix_shasum_manjaro.sh
Created July 13, 2023 18:39
Create symlink for shasum on Manjaro Linus (Gnome)
#!/bin/bash
# That snippet fixes the issue related with shasum path on Manjaro Arch Linux (Gnome)
# /usr/bin/shasum: No such file or directory
sudo ln -s /usr/bin/core_perl/shasum /usr/bin/shasum
@faniska
faniska / report_url.txt
Created July 27, 2023 17:04
Set report.url to avoid wkhtmltopdf error: Exit with code 1 due to network error: ConnectionRefusedError
# If odoo deployed in docker
# set the system parameter "report.url" as "http://localhost:8069"