This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <numeric> | |
#include <vector> | |
/// @brief: Calculates array of same size, where each element is the product | |
/// of all elements excluding corresponding by index | |
/// Algorithm: O(n) time, O(n) space | |
/// @param: array of int | |
/// @return: array of same size | |
/// @example: {1,2,3,4} => {24, 12, 8, 6}, {1, 2, 3, 4, 5} => {120, 60, 40, 30, 24} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem 1. | |
sc config "Name of Service" start= disabled | |
sc stop "Name of Service" | |
rem 2. | |
wmic service where name='SQLWriter' call ChangeStartmode Disabled | |
rem https://www.minitool.com/news/windows-10-services-to-disable.html | |
rem https://helpdeskgeek.com/windows-10/windows-10-unnecessary-services-you-can-disable-safely/ | |
rem https://www.groovypost.com/howto/12-windows-10-services-that-are-safe-to-disable/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install | |
pip3 install --user virtualenv | |
virtualenv –version | |
# Activate | |
virtualenv venv | |
source venv/bin/activate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Backup Partititon | |
dd if=/dev/sda of=/mnt/backup/sda.img conv=noerror | |
fdisk -l /dev/sda > /mnt/backup/sda.info | |
dd if=/dev/sdb of=/mnt/backup/sdb.img conv=noerror | |
fdisk -l /dev/sdb > /mnt/backup/sdb.info | |
# execute "git pull" in every dir | |
for dir in ~/projects/git/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
import random | |
import argparse | |
# Key is country code, value is the number of servers to use | |
SERVER_LIST = { | |
"AR": [*range(1, 8)], | |
"AU": [*range(13, 44)], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shell: | |
def __init__(self, cd_path): | |
self.cd_path = cd_path | |
self.exit_path = os.getcwd() | |
def __enter__(self): | |
os.chdir(self.cd_path) | |
def __exit__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time python3 jira_backup.py | |
# Output | |
# real 0m1.542s | |
# user 0m0.299s | |
# sys 0m0.136s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Method 1 | |
dd if=/dev/urandom of=/dev/null status=progress | |
# Method 2 | |
# You just need to enter a controlT character from the keyboard while the dd command is executing. | |
# By pressing the controlT character, you are sending the same SIGINFO signal to the dd command | |
# that the command pkill -INFO -x dd sends. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install sshpass | |
# $1: 1st command-line param, password | |
# $2: 2nd command-line param, username | |
# $3: 3rd command-line param, rsync source path | |
# $4: 4th command-line param, rsync destination path | |
/usr/bin/rsync -ratlz --rsh="/usr/bin/sshpass -p $1 ssh -o StrictHostKeyChecking=no -l $2" $3 $4 | |
# Alternatively, you can avoid the password prompt on rsync command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/etc/init.d/syslogd stop | |
/etc/init.d/rsyslogd stop | |
sudo systemctl disable rsyslog | |
sudo systemctl disable syslog |
NewerOlder