In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
/** Native NodeJS */ | |
var http = require('http') | |
, server = http.createServer(function(req) { | |
console.log(req.headers['user-agent']); | |
}); | |
server.listen(3000, 'localhost'); | |
/** NodeJS with Express */ | |
var express = require('express') |
Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:
NB: Check out git subtree
/git submodule
and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.
Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.
extension_id=jifpbeccnghkjeaalbbjmodiffmgedin # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc"
unzip -d "$extension_id-source" "$extension_id.zip"
Thx to crxviewer for the magic download URL.
A quick guide on how to setup Node.js development environment.
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.
npm i typescript
for local OR npm i -g typescript
for globalnode_modules/.bin/tsc --init
for local installation or tsc --init
for globaltsconfig.json
and press CTRL+F
\s* \/\* .* \*\/
# create/update resources | |
kubectl --context=minikube apply -f ./postgres.yaml | |
# In order for the service to reach the statefulset, the following should | |
# be true: | |
# statefulset.spec.selector.matchLabels.app == service.spec.selector.app | |
# statefulset.spec.selector.matchLabels.role == service.spec.selector.role | |
# give the server some time to start up | |
# ... |
To evaluate the value of msg.sender when using solidity/assembly's delegatecall:
We start out with 3 contracts:
pragma solidity ^0.5.7;
contract ScratchPadActions {
event SenderActions(address contractAddress, address sender, address second);
function relay(ScratchPad2 second) public returns (address) {
emit SenderActions(address(this), msg.sender, address(second));
#!/bin/sh | |
# From https://www.hiroom2.com/2017/09/24/parrotsec-3-8-docker-engine-en/ | |
# Changelog: | |
# @DavoedM: Apr 3, 2020 | |
# @C922A10971734: Jan 19, 2023 | |
set -e | |
# Install dependencies. |
import uuid | |
class Booking(models.Model): | |
booking_no = models.CharField(primary_key=True, default=uuid.uuid4().hex[:5].upper(), max_length=50, editable=False) | |
def __str__(self): | |
return str(self.booking_no) |