Skip to content

Instantly share code, notes, and snippets.

Avatar

Samnang Chhun samnang

View GitHub Profile
@samnang
samnang / test_private_key.pem
Last active Jul 3, 2020
Bongloy CMS Request Signing
View test_private_key.pem
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDhcS9EE66BG3ph
XixOU7mQYYM19M7Hi/u+P5zK5ZFxBRUbY9wLDvUIk1ARBZ1n1FZ4d/hYegrpxnVz
nvFn6KQSivSu93dRThY67YFY+xnzZ6r8atfzqayb7BFuDyd8ElO3dKvxHybCSKyH
RT1Mo9ZAVcLbbpepMYjzQqnESRpNQOIslRl6fALLW/Cg38yD3gVLPVzSry028Yk3
XjjliPaiuCn5ASXgxf2A4VkSpzM+3t2wF0P/PzaV3g4SVaPOERrarUiYDrN00ooq
1fmf4ta2WNgU3tr/5faJnggdtA/UmjTR/pfSs78kd7vn6TMyBMrPmCLoitol9Y87
64ztAmR0M/12UWuE1B4KciVO1UoOkxrfubvaySSDhtcT1kUA2baEXIi68hjlfrMo
da+VnqFnhnPOLONYHj9fPWPp2dSR4HjIt8aG3JkbEOAIQPD+Pr9lqRgy6WKZlOmU
zxnUfWgqsJM9DEt0nrMzPnAIRDWtIk/ABhN2cO1UK/zaQQWl2IHnGUZ83XlNWAtF
@samnang
samnang / AgentNetworkApp.java
Last active Mar 19, 2020
Bongloy Agent Network Code Snippits
View AgentNetworkApp.java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.file.*;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.spec.*;
import java.time.Instant;
import java.util.Base64;
@samnang
samnang / gist:b38c3e378228aa6525389c3876c2c8ee
Created Jul 17, 2019 — forked from olivierlacan/gist:4062929
Code School Screencasting Framework
View gist:b38c3e378228aa6525389c3876c2c8ee

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@samnang
samnang / cursor_based_pagination.rb
Created Mar 10, 2019
pseudocode of cursor based pagination in Rails
View cursor_based_pagination.rb
class CursorPaginator
attr_reader :cursor_keys, :max_items, :limit
CURSOR_DIRECTIONS = {
after: :gt,
before: :lt
}.freeze
def initialize(options = {})
@cursor_keys = options.fetch(:cursor_keys, id: :asc)
View gist:3a2292f9f3ed098c18c24fda9585a2c6
set -xe
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
. $EB_SCRIPT_DIR/use-app-ruby.sh
gem update --system
View gist:58aceb0d32b6077395ef56bee0d57c2e
<Response>
<Say voice="alice">Thanks for trying our documentation. Enjoy!</Say>
<Play>https://demo.twilio.com/docs/classic.mp3</Play>
</Response>
@samnang
samnang / aws-console
Created Feb 19, 2018 — forked from wearethefoos/aws-console
AWS Elastic Beanstalk
View aws-console
#!/usr/bin/env bash
#
# Rails console script that can be run on AWS Elastic Beanstalk.
#
# Run this script from the app dir (/var/app/current) as root (sudo script/aws-console)
#
set -xe
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
View .gitignore_global
# Compile source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@samnang
samnang / README-Template.md
Created Nov 13, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@samnang
samnang / .md
Last active Feb 17, 2017
Guard clause vs Control Structures in #Elixir?
View .md

1. Using guard

defmodule MyList do
  def max(list), do: _max(list, nil)

  defp _max([], max_value), do: max_value
  defp _max([head | tail], nil), do: _max(tail, head)

  # using guard
  defp _max([head | tail], max_value) when max_value < head, do: _max(tail, head)