Skip to content

Instantly share code, notes, and snippets.

View sagarjethi's full-sized avatar
🏠
Working from home

sagar jethi sagarjethi

🏠
Working from home
View GitHub Profile
@d2s
d2s / installing-node-with-nvm.md
Last active March 13, 2024 12:09
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
@frozeman
frozeman / token.md
Last active October 23, 2022 00:47
Token proposal

This is outdated: The ERC-20 is here: ethereum/EIPs#20

Token

Methods

totalSupply

Basic

  1. Index -> Database
  2. Type -> Table
  3. Field -> Column
localhost:9200/[index]/[type]
var n_source = eth.compile.solidity("contract naive { mapping (bytes32 => int) intRegister; function registerInt(bytes32 key, int value) external { intRegister[key] = value; } function returnInt(bytes32 key, int value) internal { msg.sender.call(bytes4(sha3(\"registerInt(bytes32,int)\")), key, value); } function makeKey(address callee, bytes32 funcName, bytes32 argsHash) internal returns (bytes32 key) { return sha3(block.blockhash(block.number), callee, funcName, argsHash); } } contract Sub is naive { function add(bytes32 key, int a, int b) external returns (int sum) { sum = a + b; returnInt(key, sum); return sum; } } contract Master is naive { function delegated(address to, int a, int b) external returns (int sum) { bytes32 argsHash = sha3(a, b); bytes32 key = makeKey(to, \"add\", argsHash); to.call(bytes4(sha3(\"add(bytes32,int,int)\")), key, a, b); return intRegister[key]; } }");
var n_master = n_source.Master;
var n_masterContract = eth.contract(n_master.info.abiDefinition);
var m_addr = "0x45b9bb86b94ae
@aamnah
aamnah / lamp.sh
Last active February 19, 2024 11:51
Bash script to install Apache, MySQL and PHP as well as PHPMyAdmin and some tweaks. For Debian and Ubuntu. To run, copy the script to the server and run ``bash lamp.sh``
#!/bin/sh
#######################################
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems.
# Written by @AamnahAkram from http://aamnah.com
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors.
#######################################
#COLORS
@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@adamcapriola
adamcapriola / page_discourse-sso.php
Last active March 24, 2020 14:21
WordPress Page Template for SSO with Discourse
<?php
/**
* Template Name: Discourse SSO
* Author: Adam Capriola
* Version: 1.1
* Author URI: https://meta.discourse.org/users/AdamCapriola/activity
* Adapted From: https://github.com/ArmedGuy/discourse_sso_php
* Uses: https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
*
*/
@blackfalcon
blackfalcon / git-feature-workflow.md
Last active April 13, 2024 07:33
Git basics - a general workflow

Git-workflow vs feature branching

When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc