Skip to content

Instantly share code, notes, and snippets.

@gabber12
gabber12 / 1.py
Last active March 27, 2020 06:24
from keras.models import Model, Sequential
from keras.layers import Input, Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dense, Dropout, Activation
from PIL import Image,UnidentifiedImageError
import numpy as np
from keras.preprocessing.image import load_img, save_img, img_to_array
from keras.applications.imagenet_utils import preprocess_input
from keras.preprocessing import image
from keras.models import model_from_json
@gabber12
gabber12 / gethost.pl
Created January 1, 2020 07:15
Perl script to call gethostbyname or gethostbyaddr
#!/usr/bin/perl
use Socket;
die("usage: gethostby-lookup name hostname\ngetbhostby-lookup addr ip\n") unless(defined($ARGV[0]) and defined($ARGV[1]));
if($ARGV[0] eq "host") {
$packed_ip = gethostbyname("$ARGV[1]");
if (defined $packed_ip) {
$ip_address = inet_ntoa($packed_ip);
print "$ip_address\n";
@gabber12
gabber12 / entrypoint.sh
Created December 18, 2017 04:55
Shell init for docker container with signal handling
# Uncomment to print commands being executed
# set -x
pid=0
# SIGTERM-handler
term_handler() {
echo "Handler INT";
if [ $pid -ne 0 ]; then
kill -SIGTERM "$pid"
wait "$pid"
@gabber12
gabber12 / Dockerfile
Created December 17, 2017 13:01
Sample Docker file for vuejs applications
# Start with node environment.
# * Download packages
# * Build application
FROM node:6 as builder
COPY . /build
WORKDIR /build
RUN npm install && npm run build
FROM nginx
@gabber12
gabber12 / hello-flask.py
Last active May 21, 2017 20:12
Hello flask application
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_flask():
return "Hello world"
app.run(host="0.0.0.0", port=8090)
@gabber12
gabber12 / gist:06fb8f238bbaf43ae0fd08d2baa74b85
Created April 25, 2017 19:16
Simple JenkinsFile for testing
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
@gabber12
gabber12 / main.py
Last active February 19, 2017 10:21
AWS resource leakage finder
import boto.ec2
from collections import defaultdict
regions = {region.name: region.name for region in boto.ec2.regions()}
class RegionPricingContext(object):
def __init__(self, region):
self.region = region
self.context = None
<script>
Notification.requestPermission().then(function(result) {
console.log(result);
});
var notify = function(message) {
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
alert("This browser does not support system notifications");
}
@gabber12
gabber12 / .vimrc
Created March 11, 2016 14:43
new Vimrc
call plug#begin()
Plug 'scrooloose/nerdtree'
Plug 'vim-scripts/Solarized'
Plug 'ervandew/supertab'
Plug 'scrooloose/nerdcommenter'
Plug 'tomasr/molokai'
Plug 'jiangmiao/auto-pairs'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'fatih/vim-go',
Plug 'nvie/vim-flake8'
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH