Skip to content

Instantly share code, notes, and snippets.

View faisalburhanudin's full-sized avatar
❤️

faisal burhanudin faisalburhanudin

❤️
View GitHub Profile
@faisalburhanudin
faisalburhanudin / utf8mb4.sql
Last active June 20, 2016 07:40
SET UTFmb4 mysql server
SHOW FULL COLUMNS FROM table_name;
# For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.)
@faisalburhanudin
faisalburhanudin / generic.py
Last active December 17, 2017 16:10
polymorphic association sqlalchemy
from sqlalchemy import event, and_
from sqlalchemy.orm import relationship, foreign, remote, backref
class PostFavorites(db.Model):
id = db.Column(db.Integer, primary_key=True, nullable=False)
user_id = db.Column(db.Integer, nullable=False)
post_id = db.Column(db.Integer, nullable=False)
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
############################################################################
from typing import List
import lxml.html
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/detail")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@faisalburhanudin
faisalburhanudin / skkh.py
Created February 26, 2018 09:54
sepasang kaos kaki hitam scraper
from requests_html import session
page = session.get('https://www.kaskus.co.id/thread/5127c3bb8327cfae2c000002/reborn-sepasang-kaos-kaki-hitam-by-pujanggalama-old-thread-version/')
index1 = page.html.xpath('//div[@class="quote expandable"]')[3]
index2 = page.html.xpath('//div[@class="quote expandable"]')[5]
def read_and_write(index):
for href in index.xpath('//a'):
from google_images_download import google_images_download
def download_datasets(keyword: str, saver, limit: int = 100):
"""Download image from google and save object to saver
:param keyword: keyword search
:param saver: function for save image
:param limit: limit per download
"""
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCs6iQt/hCbimhz13F9iRSdVFc+vHHSN9CxkGOcNyXUlI+7VD+40QJpR4L+B7YiJY5gCVla30UkJTk5qMdj8S9OTmbaqf9dRn5vUEd8ObwsSW2p6vTASuOwpnT7utL6/MOYf9W5XfnoX8iSNAdMSGyviY1qgTCcENVDD0IoYB4mDTmab+gjnYvDXMbXcPtxKaRL5MdVFRzljVJzt1KUhlr5+wZwZQVkjtiQrQuegKWO5HlX/6hefmGdY1cDiME2IFdSpxmxSp1dFzdMoi49y1Y7m+dDKNtUiyGWfdzNaHw2LcBGRE0UHNQIJH2c8iywz0+S0QsKms+duV+8g/IcOip5kf1KIc2WD1IpWjuR/77VfREYuO3kkfeDwucSGvWX2RfMtNB1tclXktZ2WWzb7Bb2EvhKF61YJBe0TOPPp0Bv2IgdfTf7AxEcJx+RcIhr3Gi9BmsTZk2OzcJd4Ws90+WN4PCY2vELCX5dWUbEM+7Kk2ktIOKiTXc8vQuWPx6YoyuvJ3ASHCFrDmr9WQYoUlA33pFcBBHb5PiVKR7UbjZz+YKdfMXbwD1aSZkAuG2enlsMSYBJV7OdnLB00Tyr8DpkY8m06Ow4bXBoZqMw5tllJH8SemjeVznFAKTHES7HhJGF1Xu3bnu/OuRxvxQS6gpWIa87Jc6E4BpjAFpvLEwEyw== faisalburhanudin@gmail.com
echo '<pre>' . var_export($array_printed, true) . '</pre>';
exit();
[
{
"Name": "5 Centimeters per Second",
"ServerId": "25e76b92db674ae3ac9d5aa0d5a3751e",
"Id": "9e3fb019ad2d7a0215533f5199322a3e",
"HasSubtitles": true,
"Container": "mkv,webm",
"PremiereDate": "2007-03-03T00:00:00.0000000Z",
"OfficialRating": "PG",
"ChannelId": null,