Skip to content

Instantly share code, notes, and snippets.

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

Taghwo Millionaire taghwo

🏠
Working from home
View GitHub Profile
@taghwo
taghwo / docker-compose-v1.yml
Created April 16, 2021 11:31 — forked from markheath/docker-compose-v1.yml
Elasticsearch docker compose examples
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@taghwo
taghwo / massInsertOrUpdate.php
Created April 15, 2021 13:49 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
class Solution:
def isPalindrome(self, s: str) -> bool:
clean_str = re.sub('[\W_]','',s).lower()
reversed_str = clean_st[::-1]
if reversed_str == clean_str:
return True
return False
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the staircase function below.
def staircase(n):
@taghwo
taghwo / py-gitignore
Created November 23, 2020 18:29 — forked from MOOOWOOO/py-gitignore
python pycharm gitignore
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
@taghwo
taghwo / ssh.py
Created November 19, 2020 13:36 — forked from AaronGhent/ssh.py
SSH - Python
#! /usr/bin/env python
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
# ssh - simple ssh2 wrapper
# Author: Aaron Ghent
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
#
# import ssh
# client = ssh.Connection(host='example.com', username='root', password='default')
# client.execute('ls')
# client.close()
@taghwo
taghwo / serializers.py
Created November 12, 2020 12:15 — forked from orehush/serializers.py
DRF simple JWT logout flow
from django.utils.text import gettext_lazy as _
from rest_framework import serializers
from rest_framework_simplejwt.tokens import RefreshToken, TokenError
class RefreshTokenSerializer(serializers.Serializer):
refresh = serializers.CharField()
default_error_messages = {
'bad_token': _('Token is invalid or expired')
}
@taghwo
taghwo / docker-help.md
Last active October 28, 2020 07:32 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

Error
ArithmeticError
DivisionByZeroError
AssertionError
CompileError
ParseError
TypeError
ArgumentCountError
Exception
ClosedGeneratorException
@taghwo
taghwo / Laravel nginx config
Created July 16, 2020 08:40
Laravel default nginx config
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#