Skip to content

Instantly share code, notes, and snippets.

Avatar

Reda NOUSHI noushi

  • EDC4IT
  • EMEA Literally
View GitHub Profile
@dpoulopoulos
dpoulopoulos / nlsh.py
Last active Jul 9, 2021
OpenAI natural language shell example.
View nlsh.py
prompt = """
Input: Print the current directory
Output: pwd
Input: List files
Output: ls -l
Input: Change directory to /tmp
Output: cd /tmp
@junaidk
junaidk / ec2.sh
Last active Jun 16, 2021
Get List of EC2 instances from All regions
View ec2.sh
# install aws cli first and configure it with credentials and default region
# the script will iterate over all regions of AWS
for region in `aws ec2 describe-regions --output text | cut -f4`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --query "Reservations[*].Instances[*].{IP:PublicIpAddress,ID:InstanceId,Type:InstanceType,State:State.Name,Name:Tags[0].Value}" --output=table --region $region
done
View openshift-cheatsheet.md

My Openshift Cheatsheet

Openshift build secrets for cloning git repos using SSH Keys

  • To create ssh secret:
oc create secret generic sshsecret \
    --from-file=ssh-privatekey=$HOME/.ssh/id_rsa
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active Jul 30, 2021
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
View imagenet1000_clsidx_to_labels.txt
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
View Using Github Deploy Key.md

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@maxtruxa
maxtruxa / Antonyms.md
Last active Jul 28, 2021
A list of common terms used in programming and their respective antonyms.
View Antonyms.md

Antonym List

Note: The table headings (positive/negative) are not necessarily meaningful.

Positive Negative
acquire release
add remove (e.g. an item), subtract (arithmetic)
advance retreat
allocate deallocate (correct), free (common)
allow deny
@yuanying
yuanying / vagrant-kvm.md
Last active Jun 26, 2021
How to use vagrant-kvm
View vagrant-kvm.md

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@brianclements
brianclements / dkcleanup.sh
Last active Jul 27, 2021
Bash script helper to remove Docker images and containers.
View dkcleanup.sh
#!/bin/bash
# options:
# remove stopped containers and untagged images
# $ dkcleanup
# remove all stopped|running containers and untagged images
# $ dkcleanup --reset
# remove containers|images|tags matching {repository|image|repository\image|tag|image:tag}
# pattern and untagged images
# $ dkcleanup --purge {image}
@XVilka
XVilka / TrueColour.md
Last active Aug 2, 2021
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Most updated version is always available at termstandard/colors repository.

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@havenwood
havenwood / bench.md
Last active Dec 12, 2015
Entirely Unscientific Benchmark of Primes in Various Ruby Implementations
View bench.md

Unscientific Benchmark

The Benchmark

def is_prime? n
  (2...n).all? { |i| n % i != 0 }
end

def sexy_primes n