Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
Harga: <input class="priceFormat" type="text"/>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('input.priceFormat').keyup(
function(e){
def ez_pattern(n, current=1):
if n == current:
__ez_pattern_mid(n, current)
else:
__ez_pattern_top(current, n)
ez_pattern(n, current + 1)
__ez_pattern_bot(current, n)
def __get_mult(printed_char, n):
div_printed_char = printed_char // 4
@LIQRGV
LIQRGV / outline.txt
Created November 19, 2019 11:54
Outline Presentasi SHA 21-11-2019
Perjalanan data di dalam rombongan data yang besar
Intro:
- Datum
- Data not datas
Pertemuan pertama:
- Data engineer
- Transformasi data:
-- Dimension table, sumbernya dari OLTP. Data ini akan di-update secara berkala ke OLAP melalui ETL.
--App usage data are kept in the following table:
--TABLE sessions
-- id INTEGER PRIMARY KEY,
-- userId INTEGER NOT NULL,
-- duration DECIMAL NOT NULL
--Write a query that selects userId and average session duration for each user who has more than one session.
--https://www.testdome.com/questions/sql/sessions/14245?visibility=1&skillId=17
select userId, avg(duration) from sessions group by userId having count(1) > 1
--The following data definition defines an organization's employee hierarchy.
--An employee is a manager if any other employee has their managerId set to the first employees id. An employee who is a manager may or may not also have a manager.
--TABLE employees
-- id INTEGER NOT NULL PRIMARY KEY
-- managerId INTEGER REFERENCES employees(id)
-- name VARCHAR(30) NOT NULL
--Write a query that selects the names of employees who are not managers.
--https://www.testdome.com/questions/sql/workers/13562?visibility=1&skillId=17
#Implement the unique_names method. When passed two arrays of names, it will return an array containing the names that appear in either or both arrays. The returned array should have no duplicates.
#For example, calling unique_names(['Ava', 'Emma', 'Olivia'], ['Olivia', 'Sophia', 'Emma']) should return an array containing Ava, Emma, Olivia, and Sophia in any order.
#https://www.testdome.com/questions/python/merge-names/24231?visibility=1&skillId=9
def unique_names(names1, names2):
unique_list = lambda input_var: list(set(input_var))
return unique_list(names1) + [name for name in unique_list(names2) if name not in names1]
names1 = ["Ava", "Emma", "Olivia"]
#As part of a data processing pipeline, complete the implementation of the pipeline method:
#The method should accept a variable number of functions, and it should return a new function that accepts one parameter arg.
#The returned function should call the first function in the pipeline with the parameter arg, and call the second function with the result of the first function.
#The returned function should continue calling each function in the pipeline in order, following the same pattern, and return the value from the last function.
#For example, pipeline(lambda x: x * 3, lambda x: x + 1, lambda x: x / 2) then calling the returned function with 3 should return 5.0.
#https://www.testdome.com/questions/python/pipeline/24245?visibility=1&skillId=9
def pipeline(*funcs):
def helper(arg):
from random import choice
from time import time
def if_function(char_input):
if char_input == "A":
return "istimewa"
if char_input == "B":
return "baik"
if char_input == "C":
return "cukup"
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
</head>
<body>
<div id="target"></div>
<script>
const malPayload = "<script>alert('1337')<\/script>";
// current code
func compileInQuery(originalQuery string, argsWithInKeyword [][]interface{}, originalArg interface{}) (string, []interface{}, error) {
/**
capturing group result:
group 0: whole match
group 1: ([a-zA-Z_]+\.)?, table name
group 2: ([a-zA-Z_]+), column name
group 3: (NOT )?, NOT flag
*/
regex := regexp.MustCompile(`([a-zA-Z_]+\.)?([a-zA-Z_]+) ([Nn][Oo][Tt] )?[Ii][Nn] \(\?\?\?\)`)
match := regex.FindAllStringSubmatch(originalQuery, -1)