Skip to content

Instantly share code, notes, and snippets.

@rachidbch
rachidbch / zcreds.py
Last active April 13, 2023 17:27
Colab Helper
__version__ = '0.1.0'
import subprocess
import os
import re
import sys
import json
import base64
import ast
import getpass
from pty import slave_open
@rachidbch
rachidbch / #docker
Last active June 11, 2021 18:45
Docker Scripts
# Docker Scripts
Scripts that can be executed from a command line
@rachidbch
rachidbch / init.docker.sh
Last active March 24, 2021 14:34
Docker & Docker-Compose Install Script
curl -fsSL https://get.docker.com | sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -aG docker $USER
newgrp docker
newgrp $USER
# Sometimes, when Docker is installed by root, but launched by user in docker group,
# Docker fails with a cryptic message about map segment error shared library libz.so.1
# This is due to Docker trying to access root's tmp folder without permission
# This teaches Docker where to look for tmp folder
@rachidbch
rachidbch / #shell
Last active June 11, 2021 01:17 — forked from kostaz/install-ripgrep-on-ubuntu.sh
Install ripgrep on Ubuntu
# Dummy file to give the Gist a proper name.
# Gist name is given by the first file in alphabetic order.
# This ia the reasons our Gists names are all prefixed by a `#`
@rachidbch
rachidbch / index.html
Created November 30, 2018 11:25
jQuery bug // source https://jsbin.com/taremu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>jQuery bug</title>
<script src="https://code.jquery.com/jquery-3.0.0.js" defer></script>
<script src="https://jsbin.com/bopuva.js" defer></script>
<script src="https://jsbin.com/wihisid.js" defer></script>
<script src="https://jsbin.com/weyiso.js" defer></script>
@rachidbch
rachidbch / defer.1.js
Last active November 30, 2018 10:54
TEST: Loading JQuery with defer attribute
window.test = "Fail Init";
// test result when jQuery ready fires
$(function() { $('#resultJQ').html("jQuery result: " + window.test);});
// test result when document is ready
document.addEventListener("DOMContentLoaded", function() { $('#resultDOM').html("DOM result: " + window.test);});
@rachidbch
rachidbch / cvim.sheetcheat.md
Last active December 30, 2023 11:51
CVIM CheatSheet

Keybindings

  • j, s scroll down scrollDown
  • k, w scroll up scrollUp
  • h scroll left scrollLeft
  • l scroll right scrollRight
  • d scroll half-page down scrollPageDown
  •   scroll full-page down	scrollFullPageDown
    
  • u, e scroll half-page up scrollPageUp
  • scroll full-page up scrollFullPageUp
@rachidbch
rachidbch / test Gist
Created September 14, 2018 09:24
This is a test GIST to try and see if i can do remote tag search from the command line
This is a test Gist
#tag1
#tag2
@rachidbch
rachidbch / tmux-cheats.md
Last active May 12, 2018 14:37 — forked from Starefossen/tmux-cheats.md
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@rachidbch
rachidbch / expecting.md
Created November 6, 2017 18:32 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect