Skip to content

Instantly share code, notes, and snippets.

View SunDi3yansyah's full-sized avatar
Verified

Cahyadi Triyansyah SunDi3yansyah

Verified
View GitHub Profile
@SunDi3yansyah
SunDi3yansyah / README.md
Created March 19, 2020 15:38
Add SWAP Memory on Linux
free -m
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
@SunDi3yansyah
SunDi3yansyah / README.md
Created March 17, 2020 06:16
RSpec List Expectations

RSpec List Expectations:

  • Ekspektasi http status code
  • Ekspektasi di header
  • Ekspektasi key dan value di response body
  • Ekspektasi jenis klass object / array / integer / float, dll
  • Ekspektasi jumlah object / array
  • Ekspektasi exception / error
@SunDi3yansyah
SunDi3yansyah / README.md
Last active September 5, 2020 05:41
MacOS kill port using CLI

MacOS kill port using CLI

Method 1

lsof -P | grep ':3000' | awk '{print $2}' | xargs kill -9

Method 2

lsof -wni tcp:3000
@SunDi3yansyah
SunDi3yansyah / main.yaml
Created February 26, 2020 11:54 — forked from ArturT/main.yaml
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
vm-job:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL then define service below.
@SunDi3yansyah
SunDi3yansyah / README.md
Last active August 13, 2020 16:03
Chmod for default directory on macOS

Chmod for default directory on macOS

chown -R $(whoami) ~/.path
find ~/path -type f -exec chmod 600 {} \;
find ~/path -type d -exec chmod 700 {} \;
chown -R $(whoami) ~/path
@SunDi3yansyah
SunDi3yansyah / post_xml.rb
Created December 15, 2019 06:08 — forked from mattriley/post_xml.rb
Ruby HTTP POST request containing XML content
require 'net/http'
def post_xml url_string, xml_string
uri = URI.parse url_string
request = Net::HTTP::Post.new uri.path
request.body = xml_string
request.content_type = 'text/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
response.body
end
@SunDi3yansyah
SunDi3yansyah / force-remove-json-183.sh
Created November 28, 2019 13:35 — forked from rubyisbeautiful/force-remove-json-183.sh
Force removal of (default) gem son 1.8.3
#!/bin/bash
mv /apps/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/specifications/default/json-1.8.3.gemspec /apps/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/specifications
gem uninstall json -v '1.8.3'
echo "done!"
@SunDi3yansyah
SunDi3yansyah / README.md
Created November 25, 2019 05:46
Install and config Redis on Mac OS X via Homebrew
@SunDi3yansyah
SunDi3yansyah / README.md
Last active March 31, 2022 05:14
Mac, Ruby building native extensions (gem install `gemname`)

Mysql / MariaDB:

gem install mysql2 -- --with-mysql-config=/usr/local/Cellar/mariadb/10.4.11/bin/mysql_config

PostgreSQL:

If you want to avoid using MacPorts, you can download the Postgres App and place it into the Application directory.

Then, specify the location of newly downloaded pg_config:

@SunDi3yansyah
SunDi3yansyah / README.md
Created November 24, 2019 16:14
How to remove the shadow effect from screenshots on Mac

How to remove the shadow from screenshots you take on your Mac

defaults write com.apple.screencapture disable-shadow -bool true ; killall SystemUIServer

How to add the shadow effect back to Mac screenshots

defaults write com.apple.screencapture disable-shadow -bool false ; killall SystemUIServer