Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

tranchausky

🏹
done
View GitHub Profile
@tranchausky
tranchausky / py.py
Created August 7, 2019 08:25
python save html tag data content website
from bs4 import BeautifulSoup
import requests
r = requests.get("https://stackoverflow.com/questions/47503845/save-html-content-into-a-txt-file-using-python")
data = r.text
soup = BeautifulSoup(data)
print(soup)
with open ('/tmp/test.html', 'a') as f:
f.write(str(soup))
@tranchausky
tranchausky / clone category.py
Created August 7, 2019 08:42
clone carw data python
import requests
import json
from bs4 import BeautifulSoup
import sys
'''
url= "https://www.skptricks.com/search/label/React%20Native"
r = requests.get(url)
soup = BeautifulSoup(r.content)
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import pymongo
from bson.objectid import ObjectId
from tornado_cors import CorsMixin
from tornado.options import define, options
import json
require 'socket'
server = TCPServer.new 5678
while session = server.accept
request = session.gets
puts request
session.print "HTTP/1.1 200\r\n" # 1
session.print "Content-Type: text/html\r\n" # 2
@tranchausky
tranchausky / options_template.php
Created August 13, 2019 10:41
wordpress add option for template (in admin)
<?php
//for in file functions.php of theme or create new plugin add
//include_once ("admin-page-more/options_template.php");
function myplugin_register_settings() {
add_option( 'myplugin_option_name', 'This is my option value.');
add_option( 'myplugin_option_name_01', '');
add_option( 'myplugin_option_email_1', '');
<?php
/**
* Theme basic setup.
*
* @package understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
// Write Javascript code here
const request = require('request');
const cheerio = require('cheerio');
const fs = require('fs');
const URL = "https://danhngoncuocsong.vn/chu-de/danh-ngon-cong-viec_1.html";
/*
var i;
@tranchausky
tranchausky / checkout.liquid
Created June 18, 2020 08:31 — forked from bxmas13/checkout.liquid
Shopify Plus Checkout.liquid template. Can be used with Timber
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="{{ locale }}" dir="{{ direction }}" class="{{ checkout_html_classes }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, height=device-height, minimum-scale=1.0, user-scalable=0">
<title>{{ shop.name }} - {{ page_title }}</title>
{{ content_for_header }}
@tranchausky
tranchausky / url-segment.js
Created June 29, 2020 03:03 — forked from jserrao/url-segment.js
Get Last Segment of a URL in Javascript
var pageURL = window.location.href;
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
console.log(lastURLSegment);
@tranchausky
tranchausky / unserialize.php
Created August 1, 2020 08:40
fix unserialize in php, fix PHP: error: Notice: unserialize(): Error at offset 438 of 750 bytes in
<?php
$str = preg_replace_callback(
'!s:(\d+):"(.*?)";!',
function($m) {
return 's:'.strlen($m[2]).':"'.$m[2].'";';
},
$str);