Skip to content

Instantly share code, notes, and snippets.

Avatar

Reda NOUSHI noushi

  • EDC4IT
  • EMEA Literally
View GitHub Profile
@junaidk
junaidk / ec2.sh
Last active Jun 12, 2020
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
@maxtruxa
maxtruxa / Antonyms.md
Last active Sep 29, 2020
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 Sep 23, 2020
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 7, 2020
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 Sep 28, 2020
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

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
@leifg
leifg / Vagrantfile
Last active Sep 18, 2020
Add a second disk to system using vagrant
View Vagrantfile
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@danielbeardsley
danielbeardsley / memcache-stats.sh
Created Aug 2, 2012
Pipe memcache stats into Graphite
View memcache-stats.sh
#!/bin/bash
if [ "$1" != "report" ]; then
echo "Usage:" >&2
script="`basename $0`"
echo " nohup $script report > /var/log/memcache-stats.log &" >&2
exit 1
fi
GRAPHITE_SERVER=localhost
@jmervine
jmervine / bm_test.rb
Created Jul 22, 2012
Benchmark A/B Test Suite
View bm_test.rb
#!/usr/bin/env ruby
require 'benchmark'
# require libs here
iterations = ARGV[0]||100000 # pass in iterations or
You can’t perform that action at this time.