Skip to content

Instantly share code, notes, and snippets.

View bitsnaps's full-sized avatar
🌍
Working @ CorpoSense

Ibrahim H. bitsnaps

🌍
Working @ CorpoSense
View GitHub Profile
@bitsnaps
bitsnaps / docker-install.sh
Last active July 5, 2021 13:24
Automated installation of Docker 20.10.7 on Ubuntu 20.04 focal
# Install Docker 20.10.7 on Ubuntu 20.04 focal
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# This is for amd64_x86 architecture (checkout for other architectures: https://docs.docker.com/engine/install/ubuntu/)
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
@bitsnaps
bitsnaps / learn_dart.dart
Last active August 3, 2021 18:34
A simple dart sheet summary
// Dart is a C-Like strongly static typed language
// variable are pass-reference-by-value
// Everything is an Object
/*
* Data Type in Dart
Data Type | Keyword | Description
Number | int, double, num | Numbers in Dart are used to represent numeric literals
Strings | String | Strings represent a sequence of characters
@bitsnaps
bitsnaps / groovyc.groovy
Last active August 26, 2021 19:56
Activate Type Checking and Compile Static for all Groovy classes in Gradle (or Android) project
// We know we can apply type checking and compile static on all groovy classes, the good news you can do this on gradle build, so it'll be applied in every class in your project, this works in android project.
/*/ In gradle project:
apply plugin: 'groovy'
compileGroovy.groovyOptions.configurationScript = file('gradle/config/groovyc.groovy')
// In Android project (app/build.gradle)
androidGroovy {
options {
configure(groovyOptions) {
@bitsnaps
bitsnaps / simplest_tf.py
Last active November 11, 2021 09:05
keras (tensorflow) simplest linear model example
# Simplest linear model with keras 2.1.3 (using tensorflow backed) it worked with python 3.5
import numpy as np
import keras
model = keras.Sequential( [keras.layers.Dense(units=1, input_shape=[1])] )
model.compile(optimizer='sgd', loss='mean_squared_error')
# y = 2x - 1
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0])
ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0])
@bitsnaps
bitsnaps / App.vue
Created May 7, 2022 16:43 — forked from bricksroo/App.vue
Reveal.js in Vue
<template>
<div id="app">
<!-- <img src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/> -->
<div class="reveal">
<div class="slides">
<section>Single Horizontal Slide</section>
<section>
<section>Vertical Slide 1</section>
<section>Vertical Slide 2</section>
@bitsnaps
bitsnaps / gist_to_github_repo.md
Last active August 18, 2024 09:14 — forked from ishu3101/gist_to_github_repo.md
Transfer a gist to a GitHub repository

Transfer a gist to a GitHub repository

clone the gist

git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9

rename the directory

mv 6fb35afd237e42ef25f9 ConvertTo-Markdown

change the working directory to the newly renamed directory

cd ConvertTo-Markdown

@bitsnaps
bitsnaps / App.groovy
Created July 26, 2022 15:44
Groovy and Renjin the embedded R language engine
package demo
import javax.script.*
import org.renjin.script.*
class App {
static void main(String[] args){
// init values
int[] values = [1,2,3]
// Create a Renjin engine:
@bitsnaps
bitsnaps / plot_rbm_logistic_classification.py
Last active July 29, 2022 05:45 — forked from understar/plot_rbm_logistic_classification.py
scikit-learn RBM feature extraction and logistic classification
"""
Update: (07.29.2022): Fix: train_test_split import
==============================================================
Restricted Boltzmann Machine features for digit classification
==============================================================
For greyscale image data where pixel values can be interpreted as degrees of
blackness on a white background, like handwritten digit recognition, the
Bernoulli Restricted Boltzmann machine model (:class:`BernoulliRBM
<sklearn.neural_network.BernoulliRBM>`) can perform effective non-linear
@bitsnaps
bitsnaps / upper_confidence_bound.py
Last active July 30, 2022 14:08 — forked from devamitranjan/UCB.py
Upper Confidence Bound Implementation
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
class UpperConfidenceBound:
def __init__(self, dataframe, N, m):
self.__dataset = dataframe
self.__N = N
self.__m = m
@bitsnaps
bitsnaps / base64coding.groovy
Created September 24, 2022 09:45 — forked from mujahidk/base64coding.groovy
Base64 encoding and decoding in Groovy.
def text = "Going to convert this to Base64 encoding!"
// Encode
def encoded = text.bytes.encodeBase64().toString()
println encoded
// Decode
byte[] decoded = encoded.decodeBase64()
println new String(decoded)