Skip to content

Instantly share code, notes, and snippets.

@onlyforbopi
onlyforbopi / 0_reuse_code.js
Created December 12, 2016 08:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@onlyforbopi
onlyforbopi / BASIC MODULES - REQUESTS
Last active October 11, 2017 11:03
1. HTTP AND RESTFUL BASIC THEORY 2. BASIC MODULES - REQUEST 3. HTTPRESTFULCOMMANDS.py (COMMAND OVERVIEW) 4. DOWNLOAD FILES WITH HTTP/RESTFUL USING PYTHON - pythonhttprestdl.py 5. DOWNLOADING COMPARISON AND OVERVIEW OF METHODS- dlmethodstest.py
Request Library
The Requests python library is simple and straight forward library for developing RESTful Clients.
Python has a built in library called urllib2, it is bit complex and old style when compared to Requests.
After writing couple of programs using the urllib2, I am completely convinced by the below statement issued by the
developers of Requests. Also refer the Reference[4] for comparing the code segments written using
urllib2 and requests library.
Python’s standard urllib2 module provides most of the HTTP capabilities you need, but the API is thoroughly
broken. It was built for a different time — and a different web. It requires an enormous amount of work
(even method overrides) to perform the simplest of tasks.
@onlyforbopi
onlyforbopi / CLEANCSS.bash
Created October 17, 2017 20:30
VARIOUS HELPFUL USES OF SED WITH HTML AND CSS
sed 's/{/\n{\n/g' | sed s'/}/\n}/ file_in > file_ot
@onlyforbopi
onlyforbopi / BASE64AUTH.PY
Last active November 10, 2017 08:31
1. HTTP AND RESTFUL BASIC THEORY 2. BASIC MODULES - REQUEST 3. HTTPRESTFULCOMMANDS.py (COMMAND OVERVIEW) 4. DOWNLOAD FILES WITH HTTP/RESTFUL USING PYTHON - pythonhttprestdl.py 5. DOWNLOADING COMPARISON AND OVERVIEW OF METHODS- dlmethodstest.py 6. SIMPLE HTTP HANDSHAKES AND URLS 7. Base64 authentification
import requests, base64
usrPass = "userid:password"
b64Val = base64.b64encode(usrPass)
r=requests.post(api_URL,
headers={"Authorization": "Basic %s" % b64Val},
data=payload)
@onlyforbopi
onlyforbopi / 2tablecompare.abap
Last active March 8, 2018 09:46
1. Declare and fill itab 2. Check if table is filled with data and report on lines read 3. Select rows in itab based on key in itab2 (for all entries) 4. Compare two tables 5. Export file to table 6. Simple Query (No Join) / File Output 7
****************************************************************
* COMPARE TWO TABLES
* TWO TABLE COMPARISON
* LOGIC: 1 - Loop over itab gt_ebill_ca
* 2 - Read itab gt_fkkvkp with key vkont = gt_ebill-vkont
* 3 - At this point we have read one line from each table, for the same vkont
* 4 - Control block
* 5 - MOVE-CORRESPONDING FROM TABLE A TO OUTPUT WORK AREA (IT HAS SAME NAME AS TABLE)
* 6 - MOVE-CORRESPONDING FROM TABLE B TO OUTPUT WORK AREA
@onlyforbopi
onlyforbopi / SimpleVersionControl
Created January 11, 2018 12:39
Short snippet - Expand
se38 - Input program name
"Βοηθητικα Προγραμματα" -> "Διαχειριση εκδοσεων"
Θα εμφανιστει σελιδα με δυο πλαισια:
1. Versions in dev db
2. Versions in version db
We can select one from each side, and use the "Compare" button to see changes in code.
@onlyforbopi
onlyforbopi / Stylesinhead.html
Last active January 30, 2018 13:26
Inline css are used to add css attributes to elements (usually div tags) inline, without a separate css folder. To set inline css attributes we have to use the "style" attribute. The "style" attribute can be attacked to any tag: <div>, <p>, <head>,
#########################
# How to set styles in <head>
#aaa {
font-weight="bold"
....
}
* This style will apply only to div that contain div aaa
@onlyforbopi
onlyforbopi / TableTemplates.html
Last active January 30, 2018 13:57
1. Basic Table Usage 2. Table Specific Attributes 3. Tables with thead/tbody 4. Tables and the colspan attribute 5. Tables with the row span 6. Tables with background color/images 7. Nested tables and table colored borders 5. Tables with various inl
<!-- Simple table template -->
<table>
<tr>
<th>Name</th>
<th>Favorite Color</th>
</tr>
<tr>
@onlyforbopi
onlyforbopi / BasicLink.html
Last active January 16, 2018 21:38
Various way to manipulate Links and images 1. BasicLinks 2. NewWindowLinks 3. JSpopupLinks 4. Email Homers 5. JumpNamedAnchor 6. ColoredLink 7. TextDecorationsonLink 8. HoverLinks 9. ImageLinks 10. Base Link template
@onlyforbopi
onlyforbopi / PDFCutter.py
Last active February 12, 2020 08:52
Python.PDF.PDFManipulation #python #Python #PythonModules #pypdf #PDF #pdf #pdfmanipulation #Modules How to manipulate pdf (needs work) Modules: pyPdf (Unmaintained) pyPDF2(Ok version)
# doc3333
import os
import sys
import PyPDF2
file_in = sys.argv[1]
file_ot = sys.argv[2]