Skip to content

Instantly share code, notes, and snippets.

@pmaoui
pmaoui / merkle.sh
Created June 28, 2022 21:08
Merkle root of a bitcoin block calculated in bash
#!/bin/bash
# usage : ./merkel.sh tx1 tx2 ... txn
# better: ./merkel.sh $(bitcoin-cli getblock {hashOfABlock}|jq -rc '.tx[]')
function concat() {
echo -e "$1$2"
}
@pmaoui
pmaoui / chart.js
Created September 21, 2018 12:08
Go JS Mapping chart
const $ = go.GraphObject.make; // for conciseness in defining templates
myDiagram = $(go.Diagram, 'myDiagramDiv', // must name or refer to the DIV HTML element
{
initialContentAlignment: go.Spot.Center,
layout: $(go.ForceDirectedLayout),
allowDelete: false,
allowCopy: false,
}
@pmaoui
pmaoui / Extractor.js
Created May 1, 2018 16:25
Extract key/value from JSON to a csv format.
const fs = require('fs');
const _ = require('lodash');
const dot = require('dot-object');
const [node, namefile, ...langs] = process.argv;
const separator = '";"';
const AllTrads = {};
const translations = [];;
@pmaoui
pmaoui / chenv.sh
Last active February 19, 2018 13:54
#!/bin/zsh
UXA_CONFIG="$WORKSPACE/mousetest/app/config/parameters.dev.yml"
PP_CONFIG="$WORKSPACE/project-parameters/conf/env.json"
CAF_CONFIG="$WORKSPACE/cs-app-feature/conf/env.json"
environnements=(dev future next1 next2 next3 next4 next5 staging Quit)
select opt in "${environnements[@]}"
do
case $opt in
import { NgAboutComponentClass } from "./mycomp.ng.component";
.state({
name: 'mynewroute',
url: '/mynewroute',
component: NgAboutComponentClass
});
import 'zone.js';
import 'reflect-metadata';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { UpgradeModule } from '@angular/upgrade/static';
@NgModule({
imports: [
BrowserModule,
UpgradeModule
]
})
export class AppModule {
@pmaoui
pmaoui / systemjs.config.ts
Created February 1, 2018 16:59
AngularJS to Angular5 — Upgrading a large application
(function (global) {
const pathPrefix = (typeof window !== 'undefined' ? '/' : './');
System.config({
baseURL: '/dist',
defaultJSExtensions: true,
paths: {
// paths serve as alias
'npm:*': pathPrefix + 'node_modules/*'
},
// map tells the System loader where to look for things
@pmaoui
pmaoui / tsconfig.json
Last active February 1, 2018 16:59
AngularJS to Angular5 — Upgrading a large application
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noStrictGenericChecks": true,
"lib" : ["es2015", "dom"],
@pmaoui
pmaoui / theme-jenkins-cs.css
Last active March 16, 2017 17:44
Theme Jenkins ContentSquare
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png