Skip to content

Instantly share code, notes, and snippets.

View rabbithunter0502's full-sized avatar

Le Trong Duc rabbithunter0502

View GitHub Profile
@rabbithunter0502
rabbithunter0502 / no_accent_vietnamese.py
Created November 2, 2022 12:54 — forked from thuandt/no_accent_vietnamese.py
Chuyển đổi từ Tiếng Việt có dấu sang Tiếng Việt không dấu
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Chương trình chuyển đổi từ Tiếng Việt có dấu sang Tiếng Việt không dấu
Chỉnh sửa từ mã nguồn của anh NamNT
http://www.vithon.org/2009/06/14/x%E1%BB%AD-ly-ti%E1%BA%BFng-vi%E1%BB%87t-trong-python
"""
import re
INTAB = "ạảãàáâậầấẩẫăắằặẳẵóòọõỏôộổỗồốơờớợởỡéèẻẹẽêếềệểễúùụủũưựữửừứíìịỉĩýỳỷỵỹđẠẢÃÀÁÂẬẦẤẨẪĂẮẰẶẲẴÓÒỌÕỎÔỘỔỖỒỐƠỜỚỢỞỠÉÈẺẸẼÊẾỀỆỂỄÚÙỤỦŨƯỰỮỬỪỨÍÌỊỈĨÝỲỶỴỸĐ"
@rabbithunter0502
rabbithunter0502 / remove_accents.py
Created November 2, 2022 12:42 — forked from J2TEAM/remove_accents.py
Remove Vietnamese Accents - Xoá dấu tiếng việt in Python
s1 = u'ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ'
s0 = u'AAAAEEEIIOOOOUUYaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy'
def remove_accents(input_str):
s = ''
print input_str.encode('utf-8')
for c in input_str:
if c in s1:
s += s0[s1.index(c)]
else:
s += c
@rabbithunter0502
rabbithunter0502 / Shopee.js
Last active October 30, 2022 17:33 — forked from Vinh2uang/Shopee.js
Cách tính tổng số tiền đã mua hàng trên Shopee
var totalOrders = 0;
var totalSpent = 0;
var totalShippingSpent = 0;
var totalItems = 0;
var pulling = true;
var offset = 0;
function getStatistics() {
var orders = [];
var xhttp = new XMLHttpRequest();
@rabbithunter0502
rabbithunter0502 / work-with-multiple-github-accounts.md
Created October 14, 2022 01:46 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent

Prefer Immutability

Our principal goal as programmers is to reduce complexity. At any point in a program, we can reason about the state of a constant trivially -- its state is the state upon assignment. By contrast, the state of a variable can change endlessly.

With judicious use, immutable objects can lead to quicker execution speed and lower memory usage. The hash value of a String, the query parameters of an immutable URL, and the distance traced by an immutable sequence of points are all immutable as well. We can cache their values for later use instead of recompute them on every access. We can also share an immutable object with clients without requiring those clients to defensively copy it.

An immutable value is safe in many ways. For example, String is immutable and so its hashCode value is immutable. Consequently, it is safe to use as a String as a key in a Map: The lower order bits of that hash will never change, and so an inserted key will never reside in the wrong bucket. An immutab

@rabbithunter0502
rabbithunter0502 / java-tip.md
Created May 3, 2021 15:34
20 very useful Java code snippets for Java Developers
  1. Converting Strings to int and int to String
  2. Append text to file in Java
  3. Get name of current method in Java
  4. Convert String to Date in Java
  5. Connecting to Oracle using Java JDBC
  6. Convert Java util.Date to sql.Date
  7. Java Fast File Copy using NIO
  8. Create Thumbnail of an image in Java
@rabbithunter0502
rabbithunter0502 / guide-to-freelancing.md
Created May 3, 2021 15:34 — forked from Himujjal/guide-to-freelancing.md
This guide intends to provide the process of learning Programming (Web and mobile) so that anyone willing to start with freelancing can get started
@rabbithunter0502
rabbithunter0502 / import-validation-summarizer-module.md
Created April 4, 2021 15:02
Cms-ui-How to use ValidationSummarizerModule

@NgModule({ imports: [ ... ValidationSummarizerModule, ... ], declarations: [ ... ], exports: [

@rabbithunter0502
rabbithunter0502 / multi-git-win.md
Created March 17, 2021 05:59 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PhotoSwipe demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Import PhotoSwipe Styles -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.0/photoswipe.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.0/default-skin/default-skin.css">