Skip to content

Instantly share code, notes, and snippets.

View loctv's full-sized avatar

Loc Truong loctv

  • kiuglobal.com
  • Ha Noi, Viet Nam
View GitHub Profile
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@loctv
loctv / file_upload_google_drive.py
Created November 8, 2023 03:06 — forked from swma24/file_upload_google_drive.py
file upload test using pydrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import time
gauth = GoogleAuth()
gauth.LoadCredentialsFile("mycreds.txt")
if gauth.credentials is None:
# Authenticate if they're not there
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
@loctv
loctv / CouchDB_Python.md
Created August 10, 2022 14:57 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@loctv
loctv / odoo_calculate_workers.sh
Created November 21, 2020 03:37
Analyzes the characteristics of the server and helps calculate the number of workers and memory for each
#!/bin/bash
# CONST 1GB
CONST_1GB="1024*1024*1024"
# VARIABLE WORKERS
CMD_W=0
@loctv
loctv / hyperjs.md
Created November 22, 2019 02:46 — forked from raftheunis87/hyperjs.md
Hyper.js + Hyper.js Plugins + ZSH + Starship + Fira Code + Dark Theme - (macOS)

Hyper.js

@loctv
loctv / wget-page.sh
Created July 24, 2019 08:17 — forked from alphapapa/wget-page.sh
Archive web pages with wget, optionally compressing with tar
#!/bin/bash
# * Defaults
compression=xz
subdir="web"
# * Functions
function debug {
@loctv
loctv / example_host.conf
Created July 23, 2019 10:29 — forked from rm3nchaca/example_host.conf
Simple script for blocking attacker bots with nginx and a lua script
server {
listen 80;
server_name example.com;
root /www/example;
access_by_lua 'denyip()'; #check error counter
error_page 400 404 405 406 = /404.html;
location = /404.html {
set $inc 1; #this is useful for blocking website scanners
set_by_lua $err 'incerror()' $inc;
@loctv
loctv / Event-stream based GraphQL subscriptions.md
Created September 24, 2018 14:44 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

WITH recursive dep_tree AS (
SELECT mdl0.id, mdl0.name, NULL::integer, 1 AS level, array[mdl0.id] AS path_info
FROM ir_module_module mdl0
WHERE name = 'sale' -- state here the child module
UNION ALL
SELECT (SELECT mdl1.id FROM ir_module_module mdl1 WHERE mdl1.name = c.name), rpad('', p.level * 1, '_') || c.name, c.module_id, p.level + 1, p.path_info||c.id
FROM ir_module_module_dependency c
JOIN dep_tree p ON c.module_id = p.id
)
SELECT level, name
@loctv
loctv / iterm2-solarized.md
Created November 7, 2017 02:57 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k