Skip to content

Instantly share code, notes, and snippets.

View onerinas's full-sized avatar

Rinas Muhammed onerinas

View GitHub Profile
@onerinas
onerinas / csv.go
Created September 29, 2020 22:33 — forked from stupidbodo/csv.go
Golang - Read CSV/JSON from URL
package main
import (
"encoding/csv"
"fmt"
"net/http"
)
func readCSVFromUrl(url string) ([][]string, error) {
resp, err := http.Get(url)
@onerinas
onerinas / uploads_controller.rb
Created March 14, 2019 04:28 — forked from longlostnick/uploads_controller.rb
Rails JSON file upload with carrierwave (from base64 string)
class Api::UploadsController < ApiController
def create
@upload = Upload.new(upload_params)
ensure
clean_tempfile
end
private
@onerinas
onerinas / _document.json.jbuilder
Created March 14, 2019 04:25 — forked from sulmanweb/_document.json.jbuilder
Active Storage as Attachment in Rails API with base64 decoding
json.extract! document, :id, :documentable_type, :documentable_id, :created_at
json.url rails_blob_url(document.doc)

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@onerinas
onerinas / ffmpeg-to-vmix.png
Created February 24, 2019 12:47 — forked from mhanney/ffmpeg-to-vmix.png
Stream webcam and audio source from PC to remote IP address using mpegts encapsulation and encoded with h264 and aac
ffmpeg-to-vmix.png
@onerinas
onerinas / dropdown_select.js
Created January 25, 2019 18:23 — forked from pelonpelon/dropdown_select.js
Mithril: Dropdowns (select boxes)
var DropDownExample = {
controller: function () {
var ctrl = this
ctrl.data = m.prop([{ name: 'alice', id: 1}, { name: 'bob', id: 2 }])
ctrl.selectedId = m.prop()
},
view: function (ctrl) {
return m('select', { onchange: m.withAttr('value', ctrl.selectedId) }, [
ctrl.data().map(function(person) {
return m('option', { value: person.id }, person.name)
@onerinas
onerinas / after.sh
Created August 4, 2017 05:03 — forked from cluppi/after.sh
Turning SSL on for Homestead
#!/bin/sh
# Config for SSL.
echo "--- Making SSL Directory ---"
mkdir /etc/nginx/ssl
echo "--- Copying $i SSL crt and key ---"
openssl req -nodes -new -x509 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj "/C=US/ST=NY/L=NYC/O=Dis/CN=www.example.com"
echo "--- Turning SSL on in nginx.conf. ---"
@onerinas
onerinas / rubyoncentos.sh
Created February 11, 2017 09:44 — forked from lovellfelix/rubyoncentos.sh
Install Ruby with Bundler on CentOS 6.5 [RVM Example]
#!/bin/bash
echo "Starting Installation..."
# Install dependencies
yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel ruby-devel libxml2 libxml2-devel libxslt libxslt-devel git
# Install Ruby from rvm
\curl -sSL https://get.rvm.io | bash -s stable --ruby
@onerinas
onerinas / ml-ruby.md
Created January 31, 2017 17:54 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

@onerinas
onerinas / Envoy.blade.php
Created January 20, 2017 15:46 — forked from halilim/Envoy.blade.php
Sample Envoy tasks for a Laravel project. - http://laravel.com/docs/ssh - https://github.com/laravel/envoy
* -A in SSH enables agent forwarding.
* -p 2122 is not needed if you use the default port of 22.
* Replace SSH_USER and example.com with your own values.
* Example run: $ envoy run deploy_demo
* --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload
@servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com'])
@task('install_test', ['on' => ['test']])
cd project