Skip to content

Instantly share code, notes, and snippets.

View GiladShoham's full-sized avatar

Gilad Shoham GiladShoham

View GitHub Profile
@GiladShoham
GiladShoham / docker-compose.yml
Last active April 26, 2024 10:08
docker compose demo for home automation
version: "3"
services:
mosquitto:
# default user/pass = admin/password
container_name: Mosquitto
# restart: always
# image: eclipse-mosquitto:latest
image: arm64v8/eclipse-mosquitto:1.6.12
# image: eclipse-mosquitto:2
@GiladShoham
GiladShoham / gist:b8d29c2ffb39bf99ee1b5ccc92b3eb90
Last active September 15, 2022 19:41
require cache issue
const fs = require('fs');
try {
require('my-package');
console.log('succuss require my-package');
} catch (err) {
console.log('failed require my-package');
}
fs.symlinkSync('pathToMyPackageInAnotherFolder', './node_modules/my-package', 'dir');
@GiladShoham
GiladShoham / index.js
Last active March 18, 2021 18:33
pnpm bug reproduce
import createResolverAndFetcher from '@pnpm/client';
async function test(){
const wantedDep = { alias: '@ci/bixdfh4o-remote.comp1', pref: '' }
const resolveOpts = {
projectDir: '/tmp/dir',
registry: 'http://localhost:4873/'
};
const storeDir = '~/.pnpm-store';
const authConfig1 = {
@GiladShoham
GiladShoham / pr-approver
Created December 27, 2020 12:44
cli tool for approve PRs via cli
const { graphql } = require("@octokit/graphql");
function getGqlClient(token){
return graphql.defaults({
headers: {
authorization: `token ${token}`,
},
});
}
const { GraphQLClient, gql } = require('graphql-request');
const scopes = ['your-scopes'];
const uri = `https://symphony.bit.dev/graphql`;
const token = 'your-token';
const graphQLClient = new GraphQLClient(uri, {
headers: {
authorization: `Bearer ${token}`
}
});
const deleteScopeQuery = gql`
//IMPORTANT - install this before: npm i child-process-promise --save-dev
/*
put this in your package.json script:
"install-collection": "node install-collection.js"
npm run install-collection <user>.<collection>
*/
const exec = require('child-process-promise').exec;
const args = process.argv;
const remote = args[2];
@GiladShoham
GiladShoham / addManyAPI.js
Last active July 1, 2019 09:17
Bit add many - programmatic API example
const COMPONENT_ORIGINS = {
IMPORTED: 'IMPORTED',
AUTHORED: 'AUTHORED',
NESTED: 'NESTED' // which is a nested dependency
};
ComponentOrigin = $Keys<typeof COMPONENT_ORIGINS>;
type PathOsBased = string; // OS based format. On Windows it's Windows format, on Linux it's Linux format.
type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}
type Warnings = {
@GiladShoham
GiladShoham / import.sh
Created December 13, 2018 11:54
import all components from a bit scope
scope=$1
if [ -z "$scope" ]
then
echo "please provide scope"
else
components=$(bit ls ${scope} -j | jq -r '.[].id' | sed 's/\[Deprecated]//g')
num_components=$(echo "$components" | wc -w | xargs)
echo "found $num_components in scope $scope"
bit import $components
fi
@GiladShoham
GiladShoham / README.md
Last active July 26, 2018 21:20 — forked from gbraad/README.md
Start C9 IDE from systemd

Start C9 IDE from systemd

Install Cloud9 first as [username]

$ su - [username]
$ wget https://github.com/gbraad/ansible-playbooks/raw/master/playbooks/install-c9sdk.yml
$ ansible-playbook install-c9sdk.yml
function* numbers() {
let index = 1;
while(true) {
yield index;
index = index + 1;
if (index > 10) {
break;
}
}
}