Skip to content

Instantly share code, notes, and snippets.

View soiqualang's full-sized avatar
🙃
hihihaha

Đỗ Thành Long soiqualang

🙃
hihihaha
View GitHub Profile
@scionoftech
scionoftech / run_on_gpu.py
Created October 3, 2019 10:02
How to run python script on GPU
# pip install --user numba
from numba import jit, cuda
import numpy as np
# to measure exec time
from timeit import default_timer as timer
# normal function to run on cpu
def func(a):
for i in range(10000000):
@soiqualang
soiqualang / postgresql-set-id-seq.sql
Created August 8, 2019 07:32 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@arno01
arno01 / docker-on-android.md
Last active October 19, 2023 07:48
Docker on Android

WORK IN PROGRESS

Docker on Android

Setup:

Samsung Galaxy Tab S5e SM-T720
Android Pie on Linux 4.9.112 (not rooted)
Termux
@profiprog
profiprog / simple-compressing.md
Last active January 4, 2024 11:34
Simple compressing base64 string in JavaScript

Story

In needed include base64 encoded simple image into HTML page in two formats:

1st as PNG format has length 196 characters and looks like this:

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAWElEQVR42mNkwA/qgbgRnwJGAgb8BwI7RkbGw5QYUAs0oGXUAPwGgKKqgYF0ANLTyAi1xhZI2WOYzsjYDJTbC2QewGHIwcERBsPcgHqgAX8pMQAcxfhyIwATTkxL+hgX2QAAAABJRU5ErkJggg==

2nd as CUR format has length 1536 characters and looks like this:

`AAACAAEAEBAAAAcABwBoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///z0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////3wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

@korakot
korakot / selenium.py
Last active March 26, 2024 07:40
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install libu2f-udev libvulkan1
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
!dpkg -i google-chrome-stable_current_amd64.deb
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
!pip install selenium chromedriver_autoinstaller
# set options to be headless, ..
@FMCorz
FMCorz / README.md
Created November 27, 2018 03:13
Adminer with SQLite no-login

Adminer setup

Enables plugins, and SQLite no-login.

Instructions

  1. Copy index.php to a new directory
  2. Download Adminer to adminer.php
@shaystrong
shaystrong / Readme.md
Last active March 26, 2020 06:52
SWIR DG processing
  1. Image download from ftp --> upload to AWS s3 bucket

  2. Pull to AWS EC2 machine. Save off SWIR band ratios as tif with appropriate contrast. The SWIR data is an 8-band image. You need to first grab onnly the bands you need for visualization (8-3-1 or 6-3-1 make good combos)

import rasterio
import numpy as np

raster='18NOV09185526-A2AS-058669488010_01_P001.TIF'. #your file
@stewartadam
stewartadam / main.py
Last active March 5, 2024 16:02 — forked from gear11/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
@apaskulin
apaskulin / advanced-formatting-github-markdown.md
Created April 15, 2018 17:49
Tips and tricks for more formatting options in GitHub Markdown

Advanced Formatting in GitHub Markdown

GitHub Flavored Markdown lets you create useful documents in GitHub and GitHub Enterprise using .md files. Like other varieties of markdown, GitHub Markdown tries to be as readable as possible in its raw form, resulting in an intentionally limited set of formatting options. However, these options can feel restrictive when dealing with complex content.

Although GitHub Markdown strips out most HTML tags, here are a few tricks that can give you more flexibility when formatting your documents. These advanced formatting options can make your documents more useable, but they come at the expense of plain text readability, so use with caution.

@reoring
reoring / gist:3ff898c90a81073ea37b96e0fef8746b
Last active October 25, 2022 02:50
docker-compose.yml for php and postgresql

html/index.php

<?php

phpinfo();

docker/Dockerfile