Skip to content

Instantly share code, notes, and snippets.

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

adonis simo simo97

🏠
Working from home
View GitHub Profile
@DipandaAser
DipandaAser / storage.go
Last active January 21, 2022 15:57
List all objects of a AWS S3 folder (bypass the limit of 1000 objects)
package storage
import (
"context"
_ "github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
_ "github.com/aws/aws-sdk-go-v2/service/s3/types"
)
@awebartisan
awebartisan / useDragDrop.ts
Last active November 2, 2020 19:35
useDragDrop hook that handles DragStart, DragOver and Drop operations
import React from 'react';
const handleDragStart = (event: React.DragEvent) => {
event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setData(
'text/plain',
event.currentTarget.getAttribute('data-index'),
);
};
Commands
------------
1. Build Docker Image
docker build -t test .
2. Run container /w image
docker run -d --publish 8888:5000 test
3. Login to ECR
aws ecr get-login-password --region REGIONHERE!!!! | docker login --username AWS --password-stdin ACCOUNTIDHERE!!!!.dkr.ecr.REGIONHERE!!!.amazonaws.com
@Sanix-Darker
Sanix-Darker / [PYTHON]PLAGON.py
Created June 6, 2020 01:07
[PYTHON]PLAGON.py
# ____ _ _ ____ ___ _ _
# | _ \| | / \ / ___|/ _ \| \ | |
# | |_) | | / _ \| | _| | | | \| |
# | __/| |___ / ___ \ |_| | |_| | |\ |
# |_| |_____/_/ \_\____|\___/|_| \_|
# --------------------------------------
from os import listdir as os_listdir, path as os_path
# pip install -U scikit-learn
from sklearn.feature_extraction.text import TfidfVectorizer
@sbinlondon
sbinlondon / synthwaveglow.md
Last active February 22, 2024 22:40
Get the synth wave glow theme working for VS Code on Mac

Get the synth wave glow working for VS Code on Mac

These notes are pretty much the same steps as the two extensions list, it's just that I had to collate them together because neither seems to list it fully in the proper order.

  1. Install Synthwave ’84/Synthwave + Fluoromachine theme on VS Code (I used the Fluoromachine one)

  2. Install Custom CSS and JS Loader

  3. Command + Shift + P to open command palette > "Preferences: Open settings (JSON)"

@Sanix-Darker
Sanix-Darker / [PYTHON]Levenshtein_distance.py
Last active October 7, 2019 10:54
[PYTHON]Levenshtein_distance
import difflib
print("Levenshtein distance implementation !")
_str = 'appel'
difflib.get_close_matches('appel', ['ape', 'apple', 'peach', 'puppy'], n=2)
# returns ['apple', 'ape']
# difflib.get_close_matches finds the best "good enough" matches.
# Here, first argument is being matched against the second one.
@kshailen
kshailen / Connecting_postgress_RDS_from_local_via_bastion.md
Last active October 12, 2022 13:26
Ways to connect to postgress RDS instance from bastion host and from local host

When it comes to databases and AWS VPC, best practice is to place your database in private subnet. By definition, private subnet in AWS is not reachable from the Internet because no Internet gateway is attached to private subnet. This is the way you protect your data. This kind of configuration is good for security but bad for data management.

How can you easily access and manage your secured data?

basic_RDS_bastion_architecture

There are two basic ways to acees it.

  1. Access postgres RDS from bastion host. There are following requirements for this.
@sundowndev
sundowndev / GoogleDorking.md
Last active April 25, 2024 00:26
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@meigwilym
meigwilym / console.php
Last active March 5, 2024 02:20
Laravel Create User Command
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([
@tobiase
tobiase / models.py
Last active October 4, 2021 11:08
Prefill wagtailforms with URL parameters
from __future__ import absolute_import, unicode_literals
import django
import django.forms
import wagtail.wagtailforms.models as form_models
from django.db import models
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (