Skip to content

Instantly share code, notes, and snippets.

View sharif2008's full-sized avatar
🎯
Focusing

Md. Shariful Islam sharif2008

🎯
Focusing
  • Dhaka
View GitHub Profile
@erickok
erickok / SelfSignedCrtCertificate.java
Last active May 11, 2023 14:25
Loading a self-signed SSL certificate .crt file and packaging it into a SSLSocketFactory for use with a HttpsURLConnection.
// Usage example...
HttpsURLConnection connection = (HttpsURLConnection) new URL("https://someurl.com").openConnection();
connection.setSSLSocketFactory(buildSslSocketFactory());
private static SSLSocketFactory buildSslSocketFactory(Context context) {
// Add support for self-signed (local) SSL certificates
// Based on http://developer.android.com/training/articles/security-ssl.html#UnknownCa
try {
@twokul
twokul / hidden-classes-in-js-and-inline-caching.md
Last active May 30, 2024 19:41
Hidden classes in JavaScript and Inline Caching

Hidden classes in JavaScript and Inline Caching

Knowing how internals work is always a good. Pretty much for everything. Cars, trains, computers, you name it. It gives you an insight on what happens under the hood. You also act/react differently based on this knowledge.

As you might have guessed, it’s also true for web development. Knowledge of CSS transitions allows you to achieve better performance and not to use JavaScript in most cases. Knowledge of V8 internals allows you to write more performant JavaScript code. So let’s talk about V8 a little.

A little about V8

V8 is a JavaScript engine built by Google. Firefox built SpiderMonkey, Opera built Carakan and Microsoft built Chakra. One very important difference between V8 and other JavaScript engines is that V8 doesn’t generate any intermediate code. It compiles JavaScr

@0mkara
0mkara / Ethereum_private_network.md
Last active July 2, 2024 00:56
Ethereum private network configuration guide.

Create your own Ethereum private network

Introduction

Used nodes:

Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@pcan
pcan / README.md
Last active October 17, 2024 05:56
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@dmmarmol
dmmarmol / run-mongodb.bat
Last active August 6, 2023 12:08
Simple Batch file for running MongoDB on a windows computer
if not exist "C:\mongodb\data\db\" mkdir C:\mongodb\data\db
if not exist "C:\mongodb\data\log\" mkdir C:\mongodb\data\log
@echo off
:: Update the 3.4 if you have another version
cd C:\Program Files\MongoDB\Server\3.4\bin
::set default port variable
set port=27017
:: add this line at the end of the ~mongod.exe to write the log on a separated file
@qx133
qx133 / tryEthereum.js
Created April 30, 2017 14:18
Try out Ethereum using only nodejs and npm!
var Web3 = require('web3');
var util = require('ethereumjs-util');
var tx = require('ethereumjs-tx');
var lightwallet = require('eth-lightwallet');
var txutils = lightwallet.txutils;
var web3 = new Web3(
new Web3.providers.HttpProvider('https://rinkeby.infura.io/')
);
var address = '0x8D68583e625CAaE969fA9249502E105a21435EbF';
var key = '1ce642301e680f60227b9d8ffecad474f15155b6d8f8a2cb6bde8e85c8a4809a';
@neuhaus
neuhaus / sign-offline.js
Last active July 15, 2024 01:49
Ethereum: Sign an offline transaction with Node and web3
#!/usr/bin/env node
'use strict';
// ethereum: generate signed transactions
const fs = require('fs-extra');
const rls = require('readline-sync');
const Accounts = require('web3-eth-accounts');
const web3utils = require('web3-utils');
const accounts = new Accounts();
import { MyChaincode } from '../<path_to_your_chaincode_class>';
import { ChaincodeMockStub, Transform } from "@theledger/fabric-mock-stub";
// You always need your chaincode so it knows which chaincode to invoke on
const chaincode = new MyChaincode();
describe('Test MyChaincode', () => {
it("Should query car", async () => {
const mockStub = new ChaincodeMockStub("MyMockStub", chaincode);
const response = await mockStub.mockInvoke("tx2", ['queryCar', `CAR0`]);
expect(Transform.bufferToObject(response.payload)).to.deep.eq({
@rponte
rponte / SignedXml.java
Last active February 2, 2024 11:35
How to sign a XML with private key certificate in Java (using Java Key Store)
package br.com.mdias.rponte.signature;
import java.util.Base64;
/**
* Represents a signed XML
*/
public class SignedXml {
private String content;