Skip to content

Instantly share code, notes, and snippets.

View aznoisib's full-sized avatar

aznoisib aznoisib

View GitHub Profile
@aznoisib
aznoisib / build_android_app_on_termux.md
Created December 11, 2023 06:56 — forked from tmatz/build_android_app_on_termux.md
Build android app on termux

Build android app on termux

1. install termux

install termux from F-Droid.

2. setup termux

apt update
@aznoisib
aznoisib / ConvertMS.js
Created February 19, 2021 17:06 — forked from flangofas/ConvertMS.js
JS: Convert Milliseconds to days? minutes? seconds? or all!
function convertMiliseconds(miliseconds, format) {
var days, hours, minutes, seconds, total_hours, total_minutes, total_seconds;
total_seconds = parseInt(Math.floor(miliseconds / 1000));
total_minutes = parseInt(Math.floor(total_seconds / 60));
total_hours = parseInt(Math.floor(total_minutes / 60));
days = parseInt(Math.floor(total_hours / 24));
seconds = parseInt(total_seconds % 60);
minutes = parseInt(total_minutes % 60);
@aznoisib
aznoisib / curl_progress.php
Created January 2, 2021 01:28 — forked from bdunogier/curl_progress.php
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@aznoisib
aznoisib / curl_progress.php
Created January 2, 2021 01:21 — forked from stuudmuffin/curl_progress.php
PHP/cURL download progress monitoring
<?php
//output buffer
ob_start();
//create javascript progress bar
echo '<html><head>
<script type="text/javascript">
function updateProgress(percentage) {
document.getElementById(\'progress\').value = percentage;
}
@aznoisib
aznoisib / downloader.php
Created January 1, 2021 21:09 — forked from ndunks/downloader.php
PHP Curl Downloader with resume support
<?php
set_time_limit(0);
ignore_user_abort(true);
$url = "http://web.shit/backup.zip";
$ch = curl_init($url);
$to_file = 'web.zip';
$opt = array();
if(is_file($to_file))
{
@aznoisib
aznoisib / HttpRequest.java
Created August 15, 2020 01:53 — forked from amitaymolko/HttpRequest.java
Simple HttpURLConnection wrapper class
package com.amitaymolko.network;
import java.util.HashMap;
/**
* Created by amitaymolko on 2/16/16.
*/
public class HttpRequest {
@aznoisib
aznoisib / jq.simple_timer.js
Created November 2, 2019 20:16 — forked from michealbenedict/jq.simple_timer.js
Simple jQuery Timer Plugin
/*
* @Module Timer
* @author : Micheal
*
* @usage:
$(document).ready(function() {
$(".s1").timer({
from: 100, //sec
end: function() {
console.log('triggerd at the end of timer')
@aznoisib
aznoisib / jQueryPluginPatterns.js
Created September 24, 2019 13:41 — forked from addyosmani/jQueryPluginPatterns.js
jQuery Plugin Patterns
/*
A (very) WIP collection of optimized/recommended jQuery plugin patterns
from @addyosmani, @cowboy, @ajpiano and others.
Disclaimer:
-----------------------
Whilst the end-goal of this gist is to provide a list of recommended patterns, this
is still very much a work-in-progress. I am not advocating the use of anything here
until we've had sufficient time to tweak and weed out what the most useful patterns
@aznoisib
aznoisib / file_upload.html
Created September 20, 2019 16:09 — forked from wwgist/file_upload.html
HTML5: files upload
<!-- via control upload -->
<input type="file" id="your-files" multiple>
<script>
var control = document.getElementById("your-files");
control.addEventListener("change", function(event) {
// When the control has changed, there are new files
var i = 0,
files = control.files,
@aznoisib
aznoisib / submit.md
Created August 31, 2019 21:23 — forked from tanaikech/submit.md
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
    • Before you use this, please enable Drive API at API console and carry out the installation of gapi.
  • When this script is run, a text file including "sample text" is created to Google Drive.
  • When you use this script, please set fileContent and metadata.

In this sample script, a text file including contents is created under a folder.