Skip to content

Instantly share code, notes, and snippets.

View hitman401's full-sized avatar

Krishna hitman401

View GitHub Profile
@hitman401
hitman401 / letsencrypt_2017.md
Created January 8, 2018 06:59 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@hitman401
hitman401 / sample.js
Created March 16, 2016 11:43
temp_forum
// libsodium wrappers is used for crypto
var libsodium = require('libsodium-wrappers');
var httpRequest = require('request');
// Generate Assymetric Key pairs
var assymetricKeys = libsodium.crypto_box_keypair();
// Generate random Nonce
var nonce = libsodium.randombytes_buf(libsodium.crypto_box_NONCEBYTES);;
// Creating the authorisation request payload
@hitman401
hitman401 / Launcher-RFC.md
Last active January 10, 2016 09:34
SAFENetwork Launcher RFC
  • Feature Name: Launcher as a local server
  • Type new feature
  • Related components safe_launcher
  • Start Date: 08-01-2016
  • RFC PR:
  • Issue number:

Summary

An alternate approach for the launcher on desktops, to reduce the application configurations and also to facilitate easier

@hitman401
hitman401 / SafeNetwork Gateway.md
Last active December 27, 2015 16:00
SafeNetwork Gateway

SafeNetwork Gateway

An alternate approach for launcher. The idea is to expose secure RESTFull APIs instead of the present IPC design. Which will allow developers to easily get started with the development on SafeNetwork. Moreover this would reduce the configuration required to bare minimum making the life of the end users easy too. Since RESTFull APIs are built on top of the standard HTTP Application layer protocol, the common tools used in practice every day can be used for debugging and development.

Detailed Design

@hitman401
hitman401 / hanshake.js
Last active December 10, 2015 15:15
Handshake example code nodejs
var sodium = require('libsodium-wrappers');
var log = require('npmlog');
// These are the commandline parameters from the launcher while starting the application
// Assign these values at run time, if trying this example
var HOST, PORT, LAUNCHER_NONCE;
var ResponseBufferHandler = function(onResponseCallback) {
var bufferQueue = [];
@hitman401
hitman401 / bytes_util.js
Created August 3, 2015 11:59
Simple snippet to convert utf8 string to bytes and vice versa
function pack(bytes) {
var chars = [];
for(var i = 0, n = bytes.length; i < n;) {
chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));
}
return String.fromCharCode.apply(null, chars);
}
function unpack(str) {
var bytes = [];
@hitman401
hitman401 / main.rs
Last active April 16, 2024 13:12
Producer Consumer Sample in RUST
use std::sync::{Arc, Mutex, Condvar};
use std::thread;
struct Producer {
cvar: Arc<(Mutex<bool>, Condvar)>
}
impl Producer {
pub fn new(cvar: Arc<(Mutex<bool>, Condvar)>) -> Producer {
Producer {
@hitman401
hitman401 / Maidsage - Grunt Helper
Created March 4, 2015 04:08
maidsafe.github.io pull from PR to be changed later. This one doesn't work as of now but must check why this fails while switching between PR
instance.pullForPR = function(selectedPR) {
if (!openPR.hasOwnProperty(selectedPR)) {
return 'echo pull failed - PR not found for selection && exit 1';
}var command;
var actualLocalBranchName;
actualLocalBranchName = selectedPR.replace(/ /g, '_');
command = (branches.indexOf(actualLocalBranchName) > -1) ? 'git branch -D ' + actualLocalBranchName + ' && ': '';
command += instance.CLI.checkout(openPR[selectedPR].base.ref) + '&&' + instance.CLI.pull() + '&&' +
instance.CLI.checkout(selectedPR, true) + '&&' +
instance.CLI.pullRemote(openPR[selectedPR].head.repo.clone_url, openPR[selectedPR].head.ref);