Skip to content

Instantly share code, notes, and snippets.

View csebille's full-sized avatar

Christophe SEBILLE csebille

View GitHub Profile
@csebille
csebille / Powershell_tips.md
Last active August 30, 2023 11:45
Powershell tips

From : https://www.it-connect.fr/creer-des-alias-persistants-en-powershell/

Persistance des alias Chaque utilisateur peut disposer d'un profil PowerShell, correspondant à un script PowerShell contenant des commandes qui seront prises en compte au démarrage d'une session PowerShell. Il est possible d'accéder à la location de ce fichier de profil en regardant le contenu de la variable $Profile :

$Profile
E:\Florian_Profil\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Cependant, cela ne signifie pas que le fichier de profil existe forcément. Pour vérifier cela, testez son existence :
@csebille
csebille / video_tips.md
Last active April 5, 2023 15:08
video tips

Capturer le bureau avec VLC

Media => Ouvrir un périphérique de capture > Mode de capture : Bureau

Dans modifier les options, on peut se limiter à une zone de l'écran : :screen-top=200 :screen-left=300 :screen-width=700 :screen-height=500

Ou à un des deux écrans : :screen-width=19200 :screen-height=1080

@csebille
csebille / gist:c9d062d863bfe96d25db4faf7703b06d
Created April 5, 2023 09:11
tmux - pultiple services started on 2 columns
#!/bin/bash
REPOS_PATH="/mnt/d/work/repos"
tmux new-session -d -c "${REPOS_PATH}/go"
# C-m acts like enter key in tmux
tmux send-keys 'env $(build_env svc service1) go run svc/service1/*.go' C-m
tmux rename-window 'sleep-training'
tmux split-window -v -p 90 -c "${REPOS_PATH}/go"
tmux send-keys 'env $(build_env svc service2) go run svc/service2/*.go' C-m
@csebille
csebille / kafka_tricks.md
Last active December 19, 2019 15:57
kafka tricks

Avec sasl_plain.properties:

security.protocol=SASL_PLAINTEXT
sasl.mechanism=GSSAPI
sasl.kerberos.service.name=kafka

Avec kafka_client_jaas.conf

KafkaClient {
@csebille
csebille / git tricks
Created November 28, 2019 15:54
git tricks
# Reset and sync local repository with remote branch
git fetch origin && git reset --hard origin/<branche> && git clean -f -d
@csebille
csebille / .bash_profile
Last active October 28, 2019 16:25
Custom MobaXTerm 12.3 bash prompt print only the three last directories but leaves all directories after a git root
function _gp ()
{
SetIt=0;
[ "$1" == "1" ] && [ ${#PWD} -gt $[COLUMNS-60] ] && SetIt=1;
[ "$1" == "2" ] && [ ${#PWD} -lt $[COLUMNS-60+1] ] && SetIt=1;
if [ "$SetIt" == "1" ]; then
IsGit=0;
GitDir="$PWD";
while [ ${#GitDir} -gt 1 ] && [ "$IsGit" == "0" ]; do
if [ -d "$GitDir/.git" ] && [ ! -e "$GitDir/.git/nawakom" ]; then
import paramiko.client
client = paramiko.client.SSHClient()
client.set_missing_host_key_policy(paramiko.client.AutoAddPolicy)
client.connect("cnp31pbd-nifi.cer31.recouv",username="nifi",password="nifi")
stdin, stdout, stderr = client.exec_command('ls -l')
out = stdout.read().decode('utf-8')
print(out)

Use local ansible to locally render jinja files

echo "Hello {{ name }} ! " > hello-world.j2
ansible all -vv --connection=local -i "localhost," -m template -a"src=hello-world.j2 dest=hello-result.txt" -e name=Toto

@csebille
csebille / abricotine_tips.md
Last active April 30, 2019 15:40
abricotine tips

To remove top, left and right margins in Abricotine, change theme.less file with :

.CodeMirror-code { margin-top: 10px; }

.CodeMirror-sizer { max-width: 90em; width: 90em; }

@csebille
csebille / pyspark.md
Created March 25, 2019 17:41
pyspark

autocompletion dans pyspark shell

import rlcompleter, readline
readline.parse_and_bind('tab: complete')