Skip to content

Instantly share code, notes, and snippets.

View layerlre's full-sized avatar

Sutachad Wichai layerlre

View GitHub Profile
{
"API": {
"HTTPHeaders": {
"Access-Control-Allow-Methods": [
"PUT",
"POST"
],
"Access-Control-Allow-Origin": [
"http://xx.xx.xx.xx:5001",
"http://localhost:3000",
@layerlre
layerlre / steps.md
Created December 16, 2021 06:18 — forked from mraaroncruz/steps.md
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

New improved next steps

  1. Go to https://web.telegram.org
  2. Click on your channel
  3. Look at the URL and find the part that looks like c12112121212_17878787878787878
  4. Remove the underscore and after c12112121212
/******************************\
!!! คำเตือน โปรดระวัง !!!
การใช้บอท มีความเสี่ยงที่จะถูกแบนได้
แนะนำให้สร้างบัญชีใหม่มาบอทโดยเฉพาะ
\******************************/
class TLMBot {
constructor(minWaitTime = 5000, maxWaitTime = 15000) {
this.minWaitTime = minWaitTime;
this.maxWaitTime = maxWaitTime;
# ============ Login SCB ========================
# To Use provide your username and password
# chmod -R 777 login_scb.sh
# ./login_scb.sh
# Please provide your username and password on https://www.scbeasy.com/
username=
password=
# Please Specify Your cookie file (Any blank text file is OK.)
# ============ Login K-Bank ========================
# To Use provide your username and password
# chmod -R 777 login_k-bank.sh
# ./login_k-bank.sh
# Please provide your username and password here
# This is not the best choice to use this script. because your password is saved on your machine and transfer through script
# Please consider K-Bank Open API instead https://apiportal.kasikornbank.com/open-api/
username=
password=
@layerlre
layerlre / jenkins_x_docker.groovy
Last active March 29, 2018 16:51
Jenkinsfile with docker and kubernetes
#!groovy​
if(env.BRANCH_NAME == 'master'){
// ################# Production ######################
node {
stage('Preparation') { // for display purposes
//Get code from a Git repository
git branch: 'master', url: 'git@bitbucket.org:myaccount/my_repo.git'
}
stage('Build') {
@layerlre
layerlre / VectorDrawableTextView
Created May 16, 2017 04:23
TextView support drawable vector
package com.layer-net.android.customview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.content.res.AppCompatResources;
import android.util.AttributeSet;
import com.layer-net.android.customview.R;
@layerlre
layerlre / IDCardUtil.java
Created March 27, 2017 06:25
Validate thai ID card
public class IDCardUtil {
public static boolean isValid(String idCard){
if (idCard.length()!=13){
return false;
}
int sum = 0;
for (int i = 0; i < 12; i++) {
sum += Character.getNumericValue(idCard.charAt(i))*(13-i);
}
@layerlre
layerlre / Retrofit2_self_sign_certificate.java
Created March 9, 2017 07:30
Retrofit2 self sign certificate
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
@layerlre
layerlre / IMEIDeviceID.java
Created November 27, 2016 06:07
Get device IMEI and device ID
...
// GET DEVICE ID
final String deviceId = Secure.getString(getContentResolver(),
Secure.ANDROID_ID);
// GET IMEI NUMBER
TelephonyManager tManager = (TelephonyManager) getBaseContext()
.getSystemService(Context.TELEPHONY_SERVICE);
String deviceIMEI = tManager.getDeviceId();
...