Skip to content

Instantly share code, notes, and snippets.

View ionutale's full-sized avatar
🏠
Working from home

ion ionutale

🏠
Working from home
  • Pisa
View GitHub Profile
@ionutale
ionutale / docker-installation.sh
Created November 1, 2021 08:19
install-docker-in-ubuntu
# Update the apt package index and install packages to allow apt to use a repository over HTTPS
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
# Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# The following command is to set up the stable repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu `lsb_release -cs` stable"
@ionutale
ionutale / how to install elasticsearch with kibana.md
Last active April 5, 2024 04:50
a small guide to install elasticsearch stack on WSL 2 docker engine

###how to install elasticsearch with kibana

#if you use the "docker WSL 2 enngine" then run the 3 command bellow, 1 at the time:

sysctl -w vm.max_map_count=262144 wsl -d docker-desktop exit

@ionutale
ionutale / showClanByTag
Created June 21, 2020 06:29
get the clan info for clash of clan
async function showClanByTag(tag) {
try {
const ClanByTag = await client.clanByTag(tag)
console.log("this is the player info:", ClanByTag)
} catch (error) {
console.error(error)
}
}
const clashApi = require('clash-of-clans-api')
let client = clashApi({
token: COC_API_TOKEN // Optional, can also use COC_API_TOKEN env variable
});
async function showPlayerInfo(tag) {
try {
const playerInfo = await client.playerByTag(tag)
console.log("this is the player info:", playerInfo)
@ionutale
ionutale / test-cosmin.c
Last active June 10, 2020 05:26
the test that cosmin had
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
@ionutale
ionutale / GCP Vision OCR - extract text from selection
Created March 29, 2020 17:39
GCP Vision OCR - extract text from selection
function textInsideRect (xMin, yMin, xMax, yMax) {
return blocks.map( block => {
return block.paragraphs.map( p => {
return {
words: p.words.map( word => {
return word.symbols.map( symbol => {
// we are drawing only rects
// compare only the first and the 3 vertice
// this should do the job
if (
@ionutale
ionutale / Vision OCR response JSON
Created March 29, 2020 17:35
this is a typical GCP Vision OCR response
{
"fullTextAnnotation": {
"pages": [
{
"blocks": [
{
"blockType": "TEXT",
"boundingBox": {
"vertices": [
{
@ionutale
ionutale / app.js
Last active March 17, 2020 04:43
medium-apollo-server-app.js
const { ApolloServer } = require('apollo-server');
const typeDefs = require('./schema');
const resolvers = require('./resolver');
const server = new ApolloServer({
typeDefs,
resolvers
});
@ionutale
ionutale / remove all variables from event
Created February 5, 2020 11:44
Dataweave 2: remove all variables from event before caching
<sub-flow name="remove-all-variables-from-the-event" >
<foreach doc:name="For Each" doc:id="f436329a-f0b8-406a-9dce-496a7313772e" collection='vars pluck ((val, key, index ) -> "varName": (key))'>
<choice doc:name="Choice" doc:id="3d469c1d-673e-465b-9b36-06dd07d034ac" >
<when expression="#[payload.varName in ['foo', 'bar']]">
<remove-variable doc:name="Remove Variable" doc:id="f38857a7-acca-4678-9b82-bb407a3528e8" variableName="#[payload.varName]" />
</when>
<otherwise >
<logger level="INFO" doc:name="Logger" doc:id="ff8a4fcc-52fc-452d-9f0f-bf893cb5b3e0" message="variable not in the remove list"/>
</otherwise>
</choice>