Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Petr Stepanov petrstepanov

🏠
Working from home
View GitHub Profile
@petrstepanov
petrstepanov / gist:f75d556fd04fff4760dc9feddb645480
Created Aug 30, 2022
C++ Round Vanue and Error to First Significant Number of the Error
View gist:f75d556fd04fff4760dc9feddb645480
//============================================================================
// Name : test.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cmath>
@petrstepanov
petrstepanov / Makefile
Created Nov 3, 2021
CERN ROOT GNU Makefile • Works on Linux and macOS
View Makefile
# Select compiler command depending on environment
OS:=$(shell uname)
CXX=g++
ifeq ($(OS),Darwin)
CXX=clang++
endif
# Variables for compiling and linking
CXXFLAGS=`root-config --cflags` -fPIC
LDFLAGS=`root-config --ldflags`
View fedora-install-root-latest.sh
#!/bin/bash
# Download the ROOT releases page and match the recent ROOT version
# https://stackoverflow.com/questions/1891797/capturing-groups-from-a-grep-regex
string=`wget https://root.cern/install/all_releases/ -q -O -`
regex="[0-9]+\.[0-9]+\/[0-9]+"
if [[ $string =~ $regex ]]
then
@petrstepanov
petrstepanov / gnome-xdg-dirs.sh
Last active Mar 31, 2021
Replaces GNOME "Documents" folder with "Development"
View gnome-xdg-dirs.sh
#!/bin/bash
rm -rf ~/Documents
mkdir -p ~/Development
sed -i 's/Documents"/Development"/' ~/.config/user-dirs.dirs
@petrstepanov
petrstepanov / fedora-install-root-6.22.08.sh
Last active Apr 1, 2021
Install CERN ROOT v.6.22.08 on Fedora with Debug symbols
View fedora-install-root-6.22.08.sh
#!/bin/bash
# Install dependencies
sudo dnf -y groupinstall "Development Tools" "Development Libraries"
sudo dnf -y install git cmake3 gcc-c++ gcc binutils libX11-devel libXpm-devel libXft-devel libXext-devel python-devel openssl-devel
sudo dnf -y install libuuid-devel redhat-lsb-core gcc-gfortran pcre-devel mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel fftw-devel cfitsio-devel graphviz-devel avahi-compat-libdns_sd-devel openldap-devel python-devel python3-numpy libxml2-devel gsl-devel R-devel R-Rcpp-devel R-RInside-devel
# Download ROOT v6.22.08 (-O overwrite existing file)
cd ~/Downloads
wget -O root_v6.22.08.source.tar.gz https://root.cern/download/root_v6.22.08.source.tar.gz
@petrstepanov
petrstepanov / fedora-install-root-6.22.06.sh
Last active Mar 31, 2021
Install CERN ROOT v.6.22.06 on Fedora with Debug symbols
View fedora-install-root-6.22.06.sh
#!/bin/bash
# Install dependencies
sudo dnf -y groupinstall "Development Tools" "Development Libraries"
sudo dnf -y install git cmake3 gcc-c++ gcc binutils libX11-devel libXpm-devel libXft-devel libXext-devel python-devel openssl-devel
sudo dnf -y install redhat-lsb-core gcc-gfortran pcre-devel mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel fftw-devel cfitsio-devel graphviz-devel avahi-compat-libdns_sd-devel openldap-devel python-devel python3-numpy libxml2-devel gsl-devel R-devel R-Rcpp-devel R-RInside-devel
# Download ROOT v6.22.06 (-O overwrite existing file)
cd ~/Downloads
wget -O root_v6.22.06.source.tar.gz https://root.cern/download/root_v6.22.06.source.tar.gz
@petrstepanov
petrstepanov / install-facetime-hd-webcam.sh
Created Sep 28, 2020
Linux Install FaceTimeHD Camera
View install-facetime-hd-webcam.sh
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@petrstepanov
petrstepanov / bot.js
Last active Mar 26, 2020
Basic Instagram Bot
View bot.js
// Bot
(function() {
function startBot(){
// Open the modal dialog on the instagram page
var items = document.querySelectorAll('a[href^="/p"]');
items[9].click();
// Define action promises
function loadPost(){
return new Promise(function(resolve, reject) {
@petrstepanov
petrstepanov / ebay-leave-feedback.js
Last active Sep 30, 2022
Ebay javascript. Leave feedback programmatically.
View ebay-leave-feedback.js
// Open eBay feedback page in your browser: https://www.ebay.com/fdbk/leave_feedback
// Paste following code in the inspector console:
var comments=['All good. Nice buyer. Fast payment!',
'Nice buyer. Quick payment!',
'A+ buyer. Come back any time!',
'Good buyer. Thanks for your business',
'Nice buyer quick payment.',
'Definitely recommend this buyer.'];
@petrstepanov
petrstepanov / emittest.c
Created Apr 27, 2019
ROOT Signal with two parameters
View emittest.c
#include <TQObject.h>
#include <RQ_OBJECT.h>
class A {
RQ_OBJECT("A")
private:
Int_t fValue1;
Int_t fValue2;
public: