Skip to content

Instantly share code, notes, and snippets.

View arahiman-mlr's full-sized avatar

Abdul Rahiman Mangalore arahiman-mlr

View GitHub Profile
@arahiman-mlr
arahiman-mlr / AttachmentUploader.kt
Created February 25, 2020 20:22 — forked from lordcodes/AttachmentUploader.kt
Code for the article: "Uploading a file with progress in Kotlin"
private fun createUploadRequestBody(
file: File,
mimeType: String,
progressEmitter: PublishSubject<Double>
): RequestBody {
val fileRequestBody = file.asRequestBody(mimeType.toMediaType())
return CountingRequestBody(fileRequestBody) { bytesWritten, contentLength ->
val progress = 1.0 * bytesWritten / contentLength
progressEmitter.onNext(progress)
@arahiman-mlr
arahiman-mlr / _summary.md
Created February 25, 2020 20:16 — forked from climabot/_summary.md
SlurmCI 7956017fb59bd1e566716c5d7f8d2816df57d77b

Commit: 7956017fb59bd1e566716c5d7f8d2816df57d77b

command ntasks jobid status elapsed
scripts/test-cpu-init.sh 8867520 00:04:02
scripts/test-cpu-tests.sh 8867521 00:45:06
scripts/test-cpu.sh test/DGmethods/advection_diffusion/pseudo1D_advection_diffusion.jl --ntasks=3 8867522 00:03:30
scripts/test-cpu.sh test/DGmethods/advection_diffusion/pseudo1D_advection_diffusion_1dimex.jl --ntasks=3 8867523 00:04:51
scripts/test-cpu.sh test/DGmethods/advection_diffusion/pseudo1D_heat_eqn.jl --ntasks=3 8867524 00:02:12
scripts/test-cpu.sh test/DGmethods/Euler/isentropicvortex.jl --ntasks=3 8867525 00:01:38
@arahiman-mlr
arahiman-mlr / docker-on-pi.sh
Created February 25, 2020 20:14 — forked from mustafaturan/docker-on-pi-rootless.sh
Install docker and run without sudo on Raspberry Pi
#!/bin/bash
# Install docker
curl -sSL https://get.docker.com | sh
# Create docker user group
sudo groupadd docker
# Add current user to the docker group
sudo gpasswd -a $USER docker
@arahiman-mlr
arahiman-mlr / setup-protobuf-mac.sh
Created February 25, 2020 20:13 — forked from mustafaturan/setup-protobuf-mac.sh
Install protobuf on Mac
#!/bin/bash
wget https://github.com/protocolbuffers/protobuf/archive/v3.7.0rc2.tar.gz
tar -zxvf protobuf-3.7.0rc2.tar.gz
cd protobuf-3.7.0rc2
./autogen.sh
./configure
make
make install
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://mashape.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mashape.com http://mashape.com/schema/mashape-api-3.0.xsd">
<method name="Get User" http="GET">
<url><![CDATA[/users/{id}]]></url>
<parameters>
<parameter optional="false">id</parameter>
</parameters>
@arahiman-mlr
arahiman-mlr / consumer.rb
Created February 25, 2020 20:10 — forked from mustafaturan/consumer.rb
Consumer class to wrap Active Resource for OAuth
# Example usage:
#
# class Account < ActiveResource::Base
# self.site = "http://localhost:3000"
# end
#
# consumer = Consumer.new( user.access_token, Account )
# consumer.find(1) # => equivalent to Account.find(1), but with OAuth
class Consumer
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@arahiman-mlr
arahiman-mlr / network-tweak.md
Created February 25, 2020 19:58 — forked from mustafaturan/network-tweak.md
Linux Network Tweak for 2 million web socket connections

Sample config for 2 million web socket connection

    sysctl -w fs.file-max=12000500
    sysctl -w fs.nr_open=20000500
    # Set the maximum number of open file descriptors
    ulimit -n 20000000

    # Set the memory size for TCP with minimum, default and maximum thresholds 
 sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'