Skip to content

Instantly share code, notes, and snippets.

@oguya
oguya / uploadFile_java.java
Last active January 3, 2016 00:28
upload file in java to server side php
public static void uploadFile(String filePath, String serverURL) throws IOException {
HttpClient httpClient = new DefaultHttpClient();
//post request to send file
HttpPost httpPost = new HttpPost(serverURL);
// StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
// StrictMode.setThreadPolicy(policy);
FileBody uploadFile = new FileBody(new File(filePath));
MultipartEntity reqEntity = new MultipartEntity();
// reqEntity.addPart("the args. the server takes", uploadFile);
@oguya
oguya / uploaded_files.php
Created January 12, 2014 09:04
receive uploaded file...crud
<?php
$storage = $_SERVER['DOCUMENT_ROOT'].'/droid/uploads/';
#check uploaded file status
if(is_uploaded_file($_FILES['uploaded_file']['tmp_name'])){
echo "\nfile successfully uploaded!\n";
}else{
echo "\nfile not uploaded!\n";
exit;
@oguya
oguya / RobotoFonts.java
Created January 13, 2014 12:46
Add roboto fonts in textviews android
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/Roboto-Black.ttf");
TextView tv = (TextView) findViewById(R.id.FontTextView);
tv.setTypeface(tf);
{
"ANDROID_VERSION": 1.5,
"APP_VERSION_CODE": 8,
"APP_VERSION_NAME": 1.3,
"AVAILABLE_MEM_SIZE": 181972992,
"BRAND": "generic",
"BUILD": {
"BOARD": "unknown",
"BRAND": "generic",
"DEVICE": "generic",
@oguya
oguya / keybase.md
Last active February 17, 2016 07:24

Keybase proof

I hereby claim:

  • I am oguya on github.
  • I am oguya (https://keybase.io/oguya) on keybase.
  • I have a public key ASA1_78svc9r8nnMc6vqP9OYXyJIPPPNIkVct4oWdkyuPAo

To claim this, I am signing this object:

@oguya
oguya / parallel_sync.sh
Created July 9, 2014 19:14
backup studio projects, attempt to speedup/parallelize
#!/bin/bash
#backup studio project files
#ignore build/ dir
SRC_DIR="/home/james/AndroidStudioProjects/"
DEST_DIR="/run/media/james/tank/Backups/studio/"
cd $SRC_DIR
@oguya
oguya / bioinformatics-workshop-apps.md
Last active February 6, 2017 21:52
Tools and software to be used in the CTLGH Bioinformatics workshop from Feb 13-17.
@oguya
oguya / postgres_queries_and_commands.sql
Created September 19, 2017 20:12 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@oguya
oguya / docker-cleanup-resources.md
Created December 22, 2018 18:29 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@oguya
oguya / installing_onadata.md
Last active February 3, 2019 16:00
step-by-step notes for install Classic Ona(OnaData) on an Ubuntu 16.04 host

Installing OnaData(Classic ONA) on Ubuntu 16.04

The following are step-by-step instructions for installing Classic ONA(OnaData) on an Ubuntu 16.04 machine.

  • clone ona repo

      $ cd /opt
      $ git clone https://github.com/onaio/onadata.git
      $ mv onadata onadata-venv
    

$ cd onadata-venv