Skip to content

Instantly share code, notes, and snippets.

View gamebusterz's full-sized avatar
🍞

Sailesh Choyal gamebusterz

🍞
View GitHub Profile
@gamebusterz
gamebusterz / test_gist_idioti.sql
Created January 22, 2024 07:28
test_gist_idioti.sql
WITH
filtered_table AS (
SELECT
*
FROM
customer_traffic_hits
WHERE
hit_hour_utc >= DATEADD(day, -90, GETDATE())
AND (page_type = 'ClientMetrics' OR page_type = 'DetailPage')
AND is_robot = 0
@Description("Generates a deterministic (type 3) UUID using the specified namespace UUID and input name (using MD5 hash)")
@ScalarFunction()
@SqlType(StandardTypes.UUID)
public static Slice uuid_v3(@SqlType(StandardTypes.UUID) Slice nameSpaceUuid,@SqlType(StandardTypes.VARCHAR) Slice name)
{
java.util.UUID nameUuid = new java.util.UUID(nameSpaceUuid.getLong(0), nameSpaceUuid.getLong(SIZE_OF_LONG));
byte[] value = name.getBytes();
byte[] b = Hashing.md5().newHasher()
.putLong(Long.reverse(nameUuid.getMostSignificantBits()))
.putLong(Long.reverse(nameUuid.getLeastSignificantBits()))
-- Setup
create table json_test(id int,tree json);
insert into json_test values(16605,'{ "id": 0, "children": [{ "id": 965, "children": [{ "id": 967 }, { "id": 969 }, { "id": 971 }, { "id": 973 } ] }, { "id": 974, "children": [{ "id": 976 }, { "id": 978 } ] } ] }');
--1----------------------------------------------------------------------
WITH RECURSIVE rec (id,json_element) as
(
SELECT tree -> 'id', tree -> 'children' from json_test where (tree -> 'id')::text::int = 0
UNION all
SELECT json_element -> 'id', json_element -> 'children' from rec)
Aggregate (cost=185894.22..185894.23 rows=1 width=8)
-> Nested Loop (cost=160756.89..185894.21 rows=1 width=0)
Join Filter: ((tableB.module_id = tableCEM.module_id) AND ((uc.c_id)::bpchar = tableCEM.c_id))
-> Hash Join (cost=88782.78..110047.72 rows=1 width=74)
Hash Cond: ((tableA.user_id = tableB.user_id) AND (tableA.module = tableB.module))
-> Seq Scan on tableA (cost=0.00..16237.39 rows=670339 width=16)
-> Hash (cost=88782.76..88782.76 rows=1 width=98)
-> Hash Join (cost=68179.40..88782.76 rows=1 width=98)
Hash Cond: ((tableND.uc_id = uc.uc_id) AND (tableND.ce_id = tableCE.ce_id))
-> Seq Scan on tableND (cost=0.00..15741.92 rows=648192 width=74)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import os
path = '/home/yankee/FrenchBot/otherData/'
path2 = '/home/yankee/FrenchBotTranslated/'
os.system('mkdir -p /home/yankee/FrenchBotTranslated/')
# API_KEY = "YOUR-GOOGLE-TRANSLATE-API-KEY-HERE"
clientCompletedRegistrationValueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot emailSnapshot : dataSnapshot.getChildren()) {
Log.d("Adding",emailSnapshot.getValue().toString()+" to emailAddressList");
emailAddressList.add(emailSnapshot.getValue().toString());
Log.d("in onDataChange","emailAddressList is:"+Arrays.toString(emailAddressList.toArray()));
}
}
@gamebusterz
gamebusterz / firebase_detect_data.js
Created December 21, 2016 16:37 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
12-15 13:36:44.335 20013-20111/com.example.yankee.cw W/sinch-android-rtc: webrtc: (webrtcvoiceengine.cc:1295): webrtc: (rtp_packet_history.cc:41): Purging packet history in order to re-set status.
12-15 13:36:45.361 20013-20013/com.example.yankee.cw D/Call: onSessionEstablished: e21ed263-6c38-412f-b69c-985116925192: SessionDetails [startTime=1481789192, endTime=0, progressTime=1481789203, establishTime=1481789205, terminationCause=NONE, packetsSent=0, packetsReceived=0, error=null]
12-15 13:36:45.361 20013-20013/com.example.yankee.cw D/CallScreenActivity: Call established
12-15 13:36:45.381 20013-20111/com.example.yankee.cw W/AudioDeviceTemplate: The application should use MODE_IN_COMMUNICATION audio mode!
12-15 13:36:45.383 20013-20013/com.example.yankee.cw D/CallScreenActivity: Call offered video: true
12-15 13:36:45.467 20013-20013/com.example.yankee.cw D/CallScreenActivity: Video track added
12-15 13:36:45.514 20013-20013/com.example.yankee.cw D/VideoCapturerAndroid: VideoCapturerAndroid::surfaceCreated
1
11-22 17:34:03.545 11675-11675/com.sinch.verification.sample E/VerificationMethod: Failed initializing verification: com.sinch.verification.ServiceErrorException: Sinch backend request failed with code: 40303 message: Authorization requirement not met.
11-22 17:34:03.545 11675-11675/com.sinch.verification.sample D/VerificationMethod: Preparing to finalize verification logger.
11-22 17:34:03.548 11675-11675/com.sinch.verification.sample I/connectivity: Unregistered connectivity monitor
11-22 17:34:03.548 11675-11675/com.sinch.verification.sample E/VerificationActivity: Verification initialization failed: Sinch backend request failed with code: 40303 message: Authorization requirement not met.
11-22 17:34:03.554 11675-11675/com.sinch.verification.sample I/VerificationActivity: Falling back to flashcall verification.
11-22 17:34:03.607 11675-11675/com.sinch.verification.sample D/CellNetworkInfo: No permission to get cell signal level.
11-22 17:34:03.611 11675-11675/com.sinch.verification.sample D/PhoneMetadata:
public class SB_TextAnswerFragment extends Fragment{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// return super.onCreateView(inflater, container, savedInstanceState);
return inflater.inflate(R.layout.sb_ques_type_answer_fragment,container,false);
}
}