Skip to content

Instantly share code, notes, and snippets.

View dawud-tan's full-sized avatar
💭
Loːts 100₂.C.a.111₂.101₂

Dawud Tan dawud-tan

💭
Loːts 100₂.C.a.111₂.101₂
  • PT Pungkook Indonesia One
  • Tanjungrejo, Wirosari, Grobogan
  • X @dawud_tan
View GitHub Profile
@herpiko
herpiko / klas-pki-playground.md
Last active January 2, 2020 16:18
💻 🔨 :neckbeard: PKI

Membuat sertifikat self-signed

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem

Melihat isi sertifikat

openssl x509 -in cert.pem -text

PEM dan DER

@kchristidis
kchristidis / protobuf-serialization.md
Last active April 12, 2024 20:09
Notes on protocol buffers and deterministic serialization (or lack thereof)

There doesn't seem to be a good resource online describing the issues with protocol buffers and deterministic serialization (or lack thereof). This is a collection of links on the subject.

Protocol Buffers v3.0.0. release notes:

The deterministic serialization is, however, NOT canonical across languages; it is also unstable across different builds with schema changes due to unknown fields.

Maps documentation:

Wire format ordering and map iteration ordering of map values is undefined, so you cannot rely on your map items being in a particular order.

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="persistenceUnitName" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <!-- DB Driver -->
@VimleshS
VimleshS / ruby_cert.rb
Created August 30, 2016 09:35
Usage examples of ruby’s openssl lib
#Reference
#https://devnotcorp.wordpress.com/2012/08/21/usage-examples-of-rubys-openssl-lib/
#!/usr/bin/ruby
require 'openssl'
require 'date'
require 'time'
@puf
puf / ChatMessage.java
Last active July 12, 2021 21:56
Zero to App: Develop with Firebase (for Android - Google I/O 2016)
package com.google.firebase.zerotoapp;
public class ChatMessage {
public String name;
public String message;
public ChatMessage() {
}
public ChatMessage(String name, String message) {
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active April 10, 2024 21:00
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@meoyawn
meoyawn / EmptyRecyclerView.java
Created November 1, 2014 11:20
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@magnetikonline
magnetikonline / dumprequest.php
Last active April 19, 2024 05:50
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']
@ymnk
ymnk / ECCKeyAgreement.java
Last active December 19, 2023 18:35
ECC with Java
// The following code is from http://www.academicpub.org/PaperInfo.aspx?PaperID=14496 .
import java.math.BigInteger;
import java.security.*;
import java.security.spec.*;
import javax.crypto.KeyAgreement;
public class ECCKeyAgreement {
public static void main(String[] args) throws Exception {
KeyPairGenerator kpg;
kpg = KeyPairGenerator.getInstance("EC","SunEC");
@aodin
aodin / gist:9493190
Last active March 23, 2024 20:24
Parsing JSON in a request body with Go
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
type Message struct {