Skip to content

Instantly share code, notes, and snippets.

View ridwanray's full-sized avatar
💭
I'm Always Learning and Implementing New Things

ridwanray

💭
I'm Always Learning and Implementing New Things
View GitHub Profile
<!-- Header-->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>New Profile Created</title>
<style>
@media only screen and (max-width: 620px) {
table[class='body'] h1 {
@ridwanray
ridwanray / gist:f5b2869f108dcb33967fb3128ecaf450
Created April 18, 2023 11:29
Error Message Extractor from API (PYTHON/DJANGO)
/* eslint-disable no-case-declarations */
const genericMessage = 'Something went wrong while trying to connect with the server';
const handleApiError = (error) => {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line
console.warn('[Axios Error]', error, error?.response);
}
if (!error?.response) {
const { data } = error || {};
@ridwanray
ridwanray / docker
Created February 14, 2023 17:14 — forked from jwarykowski/docker
Docker Prune Commands
As of 1.13.0, new prune commands:
docker container prune # Remove all stopped containers
docker volume prune # Remove all unused volumes
docker image prune # Remove unused images
docker system prune # All of the above, in this order: containers, volumes, images
docker system df # Show docker disk usage, including space reclaimable by pruning
SELECT
first_name,
last_name
FROM
sales.customers
ORDER BY
LEN(first_name) DESC;
***sort by ordinal postion::**
SELECT
#save the content of this file as example.py: Need data will be created in a new file called dict.json
import json
with open('data.json') as json_file:
data = json.load(json_file)
resources =data['rows']
def no_agent_version(aws_resource):
{
"UserInfo": {
"id": "#{USER_ID}",
"email": "#{USER_EMAIL}",
"first_name": "#{USER_FIRST_NAME}",
"last_name": "#{USER_LAST_NAME}",
"name": "#{USER_NAME}",
"picture": "#{USER_PROFILE_PICTURE}",
"roles": {
"#{ROLE_NAME}": "#{ROLE_ID}"
@ridwanray
ridwanray / shell_script.md
Created August 27, 2022 11:16 — forked from mklef121/shell_script.md
I have put together in this gist, practicals and theories you need to know to become a shell Ninja. This is because Shell Scripting allows you to encapsulate common lists of commands in a file, automate processes and build easily configurable tools.

BASH SCRIPTING-- Bourne-Again Shell

A shell script is a computer program designed to be run by the Unix/Linux shell. A shell is a command-line interpreter and typical operations performed by shell scripts include file manipulation, program execution, and printing text.

Unix/Linux shells include

  • The Bourne Shell
    • Bourne shell (sh)
    • Korn shell (ksh)
@ridwanray
ridwanray / github-actions
Created August 15, 2022 08:08
github actions for postgres and redis for python app
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: mysite-app
on:
push:
branches: [ test-workflow ]
pull_request:
branches: [ master ]
@ridwanray
ridwanray / gist:331ad95cac585c8ac587883c4f2d4ddb
Created July 19, 2022 12:47 — forked from benbacardi/gist:227f924ec1d9bedd242b
Django reverse with a querystring
from django.utils.http import urlencode
def reverse_querystring(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None):
'''Custom reverse to handle query strings.
Usage:
reverse('app.views.my_view', kwargs={'pk': 123}, query_kwargs={'search': 'Bob'})
'''
base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app)
if query_kwargs:
return '{}?{}'.format(base_url, urlencode(query_kwargs))
@ridwanray
ridwanray / .js
Created August 12, 2021 16:03
Dynamic Js FIltering For Json Files
const data =
[
{ "id":1,
"name": "Red Bench",
"category": "people",
"price": 3.89,
"currency": "USD",
"image": {
"src": "https://images.pexels.com/photos/1000445/pexels-photo-1000445.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
"alt": "Red Bench Image"