Skip to content

Instantly share code, notes, and snippets.

View khanh96le's full-sized avatar

Khanh Quoc Le khanh96le

View GitHub Profile
@khanh96le
khanh96le / python-upwork dependencies error.md
Created April 26, 2018 05:37
Error logs when pip install python-upwork==1.2.3
Collecting httplib2.system-ca-certs-locater==0.1.2 (from python-upwork==1.2.3->-r requirements.txt (line 24))
  Downloading https://files.pythonhosted.org/packages/44/f6/117cf19dbaa78da797a74939068f9b93dc05470232004877fd66a5ad8bb3/httplib2.system_ca_certs_locater-0.1.2.tar.gz
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pbr/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
    Couldn't find index page for 'pbr' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
    No local packages or working download links found for pbr
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
import collections
import PIL.Image as Image
import PIL.ImageDraw as ImageDraw
import PIL.ImageFont as ImageFont
import numpy as np
from object_detection.utils.visualization_utils import STANDARD_COLORS
def visualize_boxes_and_labels_on_image_array(image,
boxes,
//////////////////////
var str = "Uppercase this string (eXcEpT ThIs) and (ThIS)";
reg = /(\(.*?\))/g;
function toUpperCase(str){
return str.toUpperCase();
}
function doubling(str){
return str+str;
}
@khanh96le
khanh96le / lab_aggregation.py
Created June 1, 2017 18:21
lab_aggregation
import pandas as pd
df = pd.read_excel("input.xlsx")
df = df.groupby(["A", "B"])["A"].count().reset_index(name="Count")
df_sum = df.groupby('B').sum().reset_index()
df1 = df.groupby('B').head(2)
df1 = df1.groupby('B')['A'].apply(lambda x: "%s" % ', '.join(x)).reset_index(name='Top')
df1.merge(df_sum)
@khanh96le
khanh96le / README.md
Created May 25, 2017 07:46
Example of README

Dillinger

N|Solid

Dillinger is a cloud-enabled, mobile-ready, offline-storage, AngularJS powered HTML5 Markdown editor.

  • Type some Markdown on the left
  • See HTML in the right
  • Magic
import pandas as pd
import numpy as np
df = pd.DataFrame(
{
'key': ['B_W', 'B_W', 'I_W', 'B_W', 'B_W', 'B_W', 'I_W', 'I_W', 'B_W'],
'text': ['a', 'b', 'b', 'd', 'e', 'f', 'f', 'f', 'g']
}
)
mask = df[df["key"] == "B_W"].index
@khanh96le
khanh96le / script.py
Created March 10, 2017 03:36
Convert column to text
import pandas as pd
import io
content = open("test5.iob2.txt", "r").read().strip()
result = content
lines = result.split("\n\n")
lines = [pd.read_table(io.StringIO(line.decode("utf-8")), names=["text", "tag"]) for line in lines]
function confirm_request(){
return new Promise(function(fulfill, reject){
dom = $(".phl")[1];
confirm_buttons = $(dom).find('button:contains("Confirm")')[0];
$(confirm_buttons).click();
setTimeout(function(){
fulfill();
}, 3000);
})
.then(function(){

Fix Error cannot connet to sqlexpress

  • goto service
  • find Sql Server Agent
  • turn it on

Create database Company with:

  • Employee(Id, Name, FullName, BirthDay, Gender, Address, Salary, LeaderId, DepartmentId)

– Department(DepartmentId, DepartmentName, Leader)

set space for a block of code

:4,9s/^/   /

It means, from line 4 to line 9, search for ^ and replace by / /

Go to a block of code using

shift 0 : move cursor to the end of block
shift 9 : move cursor to the head of block