Snippets Collections
sudo apt-get --only-upgrade install google-chrome-stable
git add `git ls-files --deleted`
xmlstarlet ed \
    -s '//project/properties' -t elem -n 'org.datadog.jenkins.plugins.datadog.DatadogJobProperty' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t attr -n 'plugin'  -v 'datadog@4.0.0' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t elem -n 'enableFile' -v 'true' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t elem -n 'tagFile' -v 'dd.properties' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t elem -n 'enableProperty' -v 'false' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t elem -n 'tagProperties' -v 'true' \
    -s '//project/properties/org.datadog.jenkins.plugins.datadog.DatadogJobProperty' -t elem -n 'emitSCMEvents' -v 'true' \
    -s '//project/builders' -t elem -n 'org.jenkinsci.plugins.managedscripts.ScriptBuildStep' \
    -s '//project/builders/org.jenkinsci.plugins.managedscripts.ScriptBuildStep' -t attr -n 'plugin'  -v 'managed-scripts@1.5.4' \
    -s '//project/builders/org.jenkinsci.plugins.managedscripts.ScriptBuildStep'  -t elem -n 'buildStepId' -v 'af186d35-e24d-46eb-a8ad-e057fb42818e' \
    -s '//project/builders/org.jenkinsci.plugins.managedscripts.ScriptBuildStep'  -t elem -n 'tokenized' -v 'false' \
    -u '//project/publishers/jenkins.plugins.slack.SlackNotifier/@plugin' -v 'slack@608.v19e3b_44b_b_9ff' \
    -d '//project/publishers/jenkins.plugins.slack.SlackNotifier/notifyEveryFailure' \
    -s '//project/publishers/jenkins.plugins.slack.SlackNotifier' -t elem -n 'notifyEveryFailure' -v 'true' \
    -u '//project/buildWrappers/hudson.plugins.timestamper.TimestamperBuildWrapper/@plugin' -v 'timestamper@1.17' \
config.xml > c.xml
sudo truncate -s 0 $(docker inspect --format='{{.LogPath}}' x)
# Reset
Color_Off='\033[0m'       # Text Reset

# Regular Colors
Black='\033[0;30m'        # Black
Red='\033[0;31m'          # Red
Green='\033[0;32m'        # Green
Yellow='\033[0;33m'       # Yellow
Blue='\033[0;34m'         # Blue
Purple='\033[0;35m'       # Purple
Cyan='\033[0;36m'         # Cyan
White='\033[0;37m'        # White

# Bold
BBlack='\033[1;30m'       # Black
BRed='\033[1;31m'         # Red
BGreen='\033[1;32m'       # Green
BYellow='\033[1;33m'      # Yellow
BBlue='\033[1;34m'        # Blue
BPurple='\033[1;35m'      # Purple
BCyan='\033[1;36m'        # Cyan
BWhite='\033[1;37m'       # White

# Underline
UBlack='\033[4;30m'       # Black
URed='\033[4;31m'         # Red
UGreen='\033[4;32m'       # Green
UYellow='\033[4;33m'      # Yellow
UBlue='\033[4;34m'        # Blue
UPurple='\033[4;35m'      # Purple
UCyan='\033[4;36m'        # Cyan
UWhite='\033[4;37m'       # White

# Background
On_Black='\033[40m'       # Black
On_Red='\033[41m'         # Red
On_Green='\033[42m'       # Green
On_Yellow='\033[43m'      # Yellow
On_Blue='\033[44m'        # Blue
On_Purple='\033[45m'      # Purple
On_Cyan='\033[46m'        # Cyan
On_White='\033[47m'       # White

# High Intensity
IBlack='\033[0;90m'       # Black
IRed='\033[0;91m'         # Red
IGreen='\033[0;92m'       # Green
IYellow='\033[0;93m'      # Yellow
IBlue='\033[0;94m'        # Blue
IPurple='\033[0;95m'      # Purple
ICyan='\033[0;96m'        # Cyan
IWhite='\033[0;97m'       # White

# Bold High Intensity
BIBlack='\033[1;90m'      # Black
BIRed='\033[1;91m'        # Red
BIGreen='\033[1;92m'      # Green
BIYellow='\033[1;93m'     # Yellow
BIBlue='\033[1;94m'       # Blue
BIPurple='\033[1;95m'     # Purple
BICyan='\033[1;96m'       # Cyan
BIWhite='\033[1;97m'      # White

# High Intensity backgrounds
On_IBlack='\033[0;100m'   # Black
On_IRed='\033[0;101m'     # Red
On_IGreen='\033[0;102m'   # Green
On_IYellow='\033[0;103m'  # Yellow
On_IBlue='\033[0;104m'    # Blue
On_IPurple='\033[0;105m'  # Purple
On_ICyan='\033[0;106m'    # Cyan
On_IWhite='\033[0;107m'   # White
1. Restore DB from a snapshot on AWS console.
2. Test connection and data need to restore
    mysql -h vpc-olivia-prod-2022-06-10-05-31.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb -A
3. Dump the ai_company_areas, ai_areas_users, ai_conversation_locs, ai_leads by company_id
    mkdir restore_1351 && cd restore_1351
    mysqldump --no-tablespaces --single-transaction --set-gtid-purged=OFF -h vpc-olivia-prod-2022-06-10-05-31.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb ai_company_areas --where="company_id=1351" > ai_company_areas.sql
    mysqldump --no-tablespaces --single-transaction --set-gtid-purged=OFF -h vpc-olivia-prod-2022-06-10-05-31.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb ai_areas_users --where="company_id=1351" > ai_areas_users.sql
    # select GROUP_CONCAT(id SEPARATOR ",") from ai_conversations where company_id=1351;
    mysqldump --no-tablespaces --single-transaction --set-gtid-purged=OFF -h vpc-olivia-prod-2022-06-10-05-31.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb ai_conversation_locs --where="conversation_id IN (2388,3024,3025,3090,3126,3139,3206,3207,3232,3283,3316,3576,3626,3949,4126,4653,5084,5166,10084,11524,11530,11536,11551,11554,19566,19624,23390,23391,23392,23393,23394,23395,23396,23397,23398,23399,23400,43780,43785,52626,52627,52628,52629,52630,52631,58514,58515,58516,58520,70029,71744,76284,80728,80729,88485,88489,99004,99005,99846,99859,99861,99864,99870,126219,126221,139283,139284,196286,196288,196289,210399,210400,372433,372434)" > ai_conversation_locs.sql
    mysqldump --no-tablespaces --single-transaction --set-gtid-purged=OFF -h vpc-olivia-prod-2022-06-10-05-31.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb ai_leads --where="company_id=1351 AND job_loc_id>0" -f > ai_leads.sql
4. Rename to temp tables with the suffix is `_r` in the dumped files
    sed -i 's/ai_company_areas_restore/ai_company_areas_r/g' ai_company_areas.sql
    sed -i 's/ai_areas_users/ai_areas_users_r/g' ai_areas_users.sql
    sed -i 's/ai_conversation_locs/ai_conversation_locs_r/g' ai_conversation_locs.sql
    sed -i 's/ai_leads/ai_leads_r/g' ai_leads.sql
5. Load restore data to the temp tables
    mysql -h vpc-olivia-prod.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb < ai_company_areas.sql
    mysql -h vpc-olivia-prod.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb < ai_areas_users.sql
    mysql -h vpc-olivia-prod.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb < ai_conversation_locs.sql
    mysql -h vpc-olivia-prod.coeq9p2f0vzm.us-east-1.rds.amazonaws.com -u apply -pakGbvgzeEy applydb < ai_leads.sql
6. Insert restore data from temp tables to the main tables
    SET foreign_key_checks = 0;
    # verify the number of restore rows
    SELECT count(*) FROM ai_company_areas_r;
    SELECT count(*) FROM ai_areas_users_r;
    SELECT count(*) FROM ai_conversation_locs_r;
    SELECT count(*) FROM ai_leads_r;

    # Restore
    INSERT IGNORE INTO ai_company_areas SELECT * FROM ai_company_areas_r;
    INSERT IGNORE INTO ai_areas_users SELECT * FROM ai_areas_users_r;
    INSERT IGNORE INTO ai_conversation_locs SELECT * FROM ai_conversation_locs_r;
    UPDATE ai_leads t1 INNER JOIN ai_leads_r t2 ON t1.id = t2.id SET t1.job_loc_id = t2.job_loc_id WHERE t1.company_id = 1351;
    SET foreign_key_checks = 1;
7. Drop restore tables (!!!!!!!!!!!!!!!!Be careful!!!!!!!!!!!!!!!!)
    drop table ai_company_areas_r;
    drop table ai_areas_users_r;
    drop table ai_conversation_locs_r;
    drop table ai_leads_r;
8. Drop the DB instance from snapshot via AWS console.
a=(a b c); x=`echo ${!a[@]}` ;echo ${x: -1} # ArrayMaxIdxNo
Press CTRL + V to enable Visual Mode.

Using the up and down arrow key, highlight the lines you wish to comment out.

Once you have the lines selected, press the SHIFT + I keys to enter insert mode.

Enter your command symbol, for example, # sign, and press the ESC key. Vim will comment out all the highlighted lines.
timezsh() {
  shell=${1-$SHELL}
  for i in $(seq 1 10); do /usr/bin/time $shell -i -c exit; done
}
#!/bin/bash

set -eu -o pipefail # fail on error and report it, debug all lines

sudo -n true
test $? -eq 0 || exit 1 "you should have sudo privilege to run this script"

echo installing the must-have pre-requisites
while read -r p ; do sudo apt-get install -y $p ; done < <(cat << "EOF"
    perl
    zip unzip
    exuberant-ctags
    mutt
    libxml-atom-perl
    postgresql-9.6
    libdbd-pgsql
    curl
    wget
    libwww-curl-perl
EOF
)

echo installing the nice-to-have pre-requisites
echo you have 5 seconds to proceed ...
echo or
echo hit Ctrl+C to quit
echo -e "\n"
sleep 6

sudo apt-get install -y tig
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
curl -u my_client_id:my_client_secret 'https://api.github.com/user/repos'
$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
$ curl -u "username" https://api.github.com
#!/usr/bin/env sh

which() {
    local path

    if [ $# -gt 0 ]; then
        for path in $(IFS=: && echo ${PATH}); do
            [ -x "${path}/${1}" ] && echo -n "${path}/${1}" && return 0
        done

        return 1
    else
        echo >&2 "Usage: which COMMAND"
        echo >&2 "Writes the full path of COMMAND to standard output"

        return 255
    fi
}
#!/usr/bin/env sh

__git_ps1() {
    git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'
}
#!/usr/bin/env bash
#
# Returns Magento document root if sourced or prints if launched as standalone
#

mageRoot="$(dirname $(realpath "${0}"))"

while [[ ! -e ${mageRoot}/app/Mage.php && ! -e ${mageRoot}/bin/magento ]]
do
    mageRoot="$(dirname $(realpath ${mageRoot}))"
done

return "${mageRoot}" 2>/dev/null || printf '%s' "${mageRoot}" && exit
kubectl exec --stdin --tty <<PODNAME>>> -n cnext-di-tst  -- /bin/bash
#!/bin/bash
# Bash Menu Script Example

PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice $REPLY which is $opt"
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
platform :ios, '___VARIABLE_VERSION___'

target '___PACKAGENAME___' do
  use_frameworks!

  pod 'SwiftGen'
  pod 'SwiftLint'
  
end
/*
 * select Clone or Download and Use SSH
 * You will get a URL for the SSH protocol in the form git@github.com:<user>/<repo>.git
 * Then run the following command in your working tree to tell Git to use this URL instead of the current one
 */ 
git remote set-url origin git@github.com:<user>/<repo>.git
sudo docker build . -t vitesse
from ai_jobs.models import CandidateJobJourney
from ai_api.services import Utils
job_jns = CandidateJobJourney.objects.filter(company_id=1038, journey_id=8747)
#job_jns = CandidateJobJourney.objects.filter(company_id=4318, journey_id=11941)
for jj in job_jns:

    jj_stage_settings = Utils.safe_jsonloads(jj.stage_settings)
    for k, v in jj_stage_settings.items():
        if v.get("interviewers"):
            v.update(interviewers='["r_5"]')
            jj_stage_settings[k] = v
    jj.stage_settings = Utils.safe_json_dumps(jj_stage_settings)
    jj.save()
from ai_jobs.models import Job
from ai_jobs.services import HiringTeamService
from ai_jobs.services.job_management import JobManagementService
from ai_jobs.constants.constants import JobRoleType
for job in jobs:
    try:
        hiring_manage_job_perms = HiringTeamService.get_hiring_manage_job_perms(job)
        hiring_manage_user_job_perms = hiring_manage_job_perms.get(JobRoleType.USER_ID, {})
        hiring_manage_user_job_perms.update({uid: True for uid in user_ids})
        hiring_manage_job_perms.update({JobRoleType.USER_ID: hiring_manage_user_job_perms})
        JobManagementService.update_hiring_team(
            job, users=hiring_manage_user_job_perms.keys(), hiring_manage_job_perms=hiring_manage_job_perms
        )

                             
for job in company_jobs:
    hiring_manage_job_perms = HiringTeamService.get_hiring_manage_job_perms(job)
    hiring_manage_role_job_perms = hiring_manage_job_perms.get(JobRoleType.ROLE_ID, {})
    hiring_manage_role_job_perms.update({uid: True for uid in user_ids})
    hiring_manage_job_perms.update({JobRoleType.ROLE_ID: hiring_manage_role_job_perms})
    JobManagementService.update_hiring_team(
        job, roles=hiring_manage_role_job_perms.keys(), hiring_manage_job_perms=hiring_manage_job_perms
    )
Normal Version: 
echo 'nice12343game' | sed -n 's/nice\(.*\)game/\1/p'

Jenkins Version:
sed -n 's/.*exited with code \\(.*\\)/\\1/p' stdout
export JAVA_HOME=/Users/kenmiya/workspace/Unity/2021.1.1f1/PlaybackEngines/AndroidPlayer/OpenJDK/jre
echo $JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
echo $PATH
RegistryKey key;
key = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo");
string MUIVerb = "Universal Send To";
string ExtendedSubCommandsKey = @"*\shell\UniSendTo\MainMenu";         
key.SetValue("MUIVerb", MUIVerb);
key.SetValue("ExtendedSubCommandsKey",ExtendedSubCommandsKey);
RegistryKey  key1 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu");
key1 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell");
RegistryKey  key2 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell\HomePC");
string MUIVerb1 = "Home PC";
key2.SetValue("MUIVerb",MUIVerb1);
string ip = "192.168.1.22";
key2.SetValue("IP",ip);
RegistryKey key3 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell\HomePC\command");
key3.SetValue("",@"H:\ERT\FileTransfer.exe");
alias co_today="git hist | grep 'Alex' | grep $(date +"%Y-%m-%d") | grep -v "Merge" | sed -e 's/\[[^][]*\]//g' | sed -e 's/\((^())*\)//g' | sed 's@.*|@@'"
$ duti -x R
RStudio.app
/Applications/RStudio.app
org.rstudio.RStudio
rsync через docker'овский туннель гонять вот так: rsync -e 'docker exec -i' --blocking-io -rv CONTAINER_NAME:/data ., главное не забыть добавить --blocking-io.
Restricted : aucun script ne peut être exécuté.

AllSigned : seuls les scripts signés peuvent être exécutés.

RemoteSigned : les scripts téléchargés depuis Internet doivent être signés pour être exécutés. 
	Les scripts présents sur votre poste de travail ne sont pas concernés et peuvent être exécutés.

Unrestricted : pas de restrictions. Les scripts peuvent être exécutés.

connaitre le mode d'execution
	Get-ExecutionPolicy
   
changer le mode d'execution
	Set-ExecutionPolicy <mode>

cree un utilisateur 
	New-ADUser 
		-Name <login> 
		-SamAccountName <login> 
		-UserPrincipaleName <mail> 
		-AccountPassword (ConvertTo-SecureString -AsPlainText <mdp> -Force ) 
		-PasswordNeverExpires $true
		-CannotChangePassword $true

activer Utilisateur
	Enable-ADAccount <samaccountname>
	Desable-ADAccount <samaccountname>

lancer script 
	powershell .\PATH

rechercher des utilisateur
	Get-ADUser -Filter *
	Get-ADUser -Filter * | select samAccountName, Name, UserPrincipalName | Export-Csv UserAdUTF8.csv -Encoding UTF8


cree un groupe 
	New-ADGroup $groupe -GroupScope Global

inserer des utilisateur dans un groupe
	Add-ADGroupMember -identity $groupe -Members <samAccountName>

recherche groupe
	Get-ADGroup -Filter *

afficher les utilisateur dans un groupe
	 Get-ADGroupMember $group | Select-Object name  | Export-Csv SEC.csv -Encoding UTF8

ide for powershell
	Notepad.exe	
star

Thu Aug 18 2022 12:40:35 GMT+0000 (UTC) https://www.google.com/search?q

#shell #lsof
star

Wed Jul 13 2022 04:59:51 GMT+0000 (UTC) https://www.google.com/search?q

#shell
star

Thu Jul 07 2022 09:37:51 GMT+0000 (UTC) https://www.google.com/search?q

#shell #go #install
star

Sat Jul 02 2022 15:14:00 GMT+0000 (UTC) https://www.google.com/search?q

#shell
star

Sat Jul 02 2022 01:46:22 GMT+0000 (UTC)

#shell
star

Mon Jun 20 2022 04:25:03 GMT+0000 (UTC)

#shell
star

Sat Jun 18 2022 07:30:02 GMT+0000 (UTC)

#bash #shell
star

Tue Jun 14 2022 03:49:01 GMT+0000 (UTC)

#shell
star

Fri Jun 10 2022 00:38:38 GMT+0000 (UTC)

#bash #shell #cli
star

Sun Jun 05 2022 23:43:21 GMT+0000 (UTC) https://linuxhint.com/comment-multiple-lines-vim/

#shell #bash #zsh
star

Mon May 30 2022 18:16:52 GMT+0000 (UTC) https://github.com/microsoft/vscode/issues/113869

#shell #bash #zsh
star

Wed Mar 16 2022 02:14:12 GMT+0000 (UTC) https://askubuntu.com/questions/519/how-do-i-write-a-shell-script-to-install-a-list-of-applications

#bash #shell
star

Wed Jan 26 2022 14:29:32 GMT+0000 (UTC) https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

#shell
star

Wed Jan 26 2022 14:22:57 GMT+0000 (UTC) https://docs.github.com/en/rest/overview/resources-in-the-rest-api

#shell
star

Wed Jan 26 2022 14:21:53 GMT+0000 (UTC) https://docs.github.com/en/rest/overview/resources-in-the-rest-api

#shell
star

Wed Jan 26 2022 14:21:49 GMT+0000 (UTC) https://docs.github.com/en/rest/overview/resources-in-the-rest-api

#shell
star

Sat Jan 08 2022 07:33:03 GMT+0000 (UTC) https://gist.github.com/juliyvchirkov/d2c7ff01846157f58b1fc1f3a3b1e36c

#shell #sh #which
star

Sat Jan 08 2022 06:27:13 GMT+0000 (UTC) https://gist.github.com/juliyvchirkov/883a050c34e23f4b4fba6ecaeb050c3b

#sh #git #ps1 #shell
star

Sat Jan 08 2022 06:07:58 GMT+0000 (UTC) https://gist.github.com/juliyvchirkov/2c5c8d54b182528e39d4565d1632f8ee#file-magentodocumentroot-sh

#bash #magento #document_root #resolve #shell
star

Thu Nov 04 2021 13:18:02 GMT+0000 (UTC) https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/

#k8s #shell #pod
star

Mon Oct 18 2021 07:57:50 GMT+0000 (UTC) https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script

#bash #sh #script #shell #shellscript
star

Mon Sep 20 2021 09:46:36 GMT+0000 (UTC)

#shell
star

Wed Sep 15 2021 19:22:09 GMT+0000 (UTC) https://www.google.com/search?q

#shell #github
star

Tue Aug 17 2021 13:18:20 GMT+0000 (UTC)

#shell #mysql
star

Fri Jul 30 2021 13:35:57 GMT+0000 (UTC)

#shell #mysql
star

Fri Jul 30 2021 11:22:00 GMT+0000 (UTC)

#shell #mysql
star

Sun Jul 18 2021 19:18:06 GMT+0000 (UTC)

#bash #shell
star

Sun Jun 20 2021 02:03:51 GMT+0000 (UTC)

#shell #unity
star

Tue Feb 23 2021 18:17:46 GMT+0000 (UTC) https://social.msdn.microsoft.com/Forums/en-US/0397ed6f-ce8f-4bfa-9934-3246d374c128/how-to-fetch-the-value-on-the-click-of-context-menu-item-and-pass-the-same-as-a-parameter-to-the?forum

#c# #shell #registry #contextmenu
star

Wed Dec 09 2020 05:38:51 GMT+0000 (UTC) https://rud.is/b/2020/02/06/prying-r-script-files-away-from-xcode-et-al-on-macos/

#shell
star

Wed Dec 09 2020 05:38:48 GMT+0000 (UTC) https://rud.is/b/2020/02/06/prying-r-script-files-away-from-xcode-et-al-on-macos/

#shell
star

Wed Dec 09 2020 05:38:43 GMT+0000 (UTC) https://rud.is/b/2020/02/06/prying-r-script-files-away-from-xcode-et-al-on-macos/

#shell
star

Wed Oct 14 2020 17:12:11 GMT+0000 (UTC) https://habr.com/ru/post/277699/

#docker #shell
star

Sun Oct 04 2020 00:52:52 GMT+0000 (UTC)

#shell #bash

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension