Skip to content

Instantly share code, notes, and snippets.

View alexjaw's full-sized avatar

Alexander Jaworowski alexjaw

  • Sweden
View GitHub Profile
@alexjaw
alexjaw / git-bare-repo.txt
Created January 28, 2023 14:57
git bare repo
The problem:
If several people are working on the same account (Linux) then it creates problems to work with remote git repos. You just do not want to store your ssh credentials in the same account.
Solution:
Set up a bare git repo that works as a "remote repo" where all users are pulling and pushing to this bare repo and not to the real remote git server. Benefits:
do not need any credentials to push to the bare repo
do not need to set up new Linux account (maybe that would have been better)
On you own local machine you set up a new remote, for example rpipoc01. Then you can push the git repo to the bare repo. After that you can clone from the bare repo to the repo where you intend to perform the work. When finished, push to the bare repo. In order to push the updates to the server, you pull the updates from bare repo to your own machine (specify when pulling the bare repo, for example rpipoc01). The push (or pull request) to the server.
git clone /home/pi/bare_repos/sss-poc-imx-web-packager.git
@alexjaw
alexjaw / tmux-notes.txt
Last active October 3, 2023 08:55
tmux notes
# tmux
todo:
- C-b :setw synchronize-panes
see tmux-notes.txt, https://gist.github.com/alexjaw
https://github.com/tmux-plugins
https://arcolinux.com/everthing-you-need-to-know-about-tmux-introduction/
https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/
https://tmuxcheatsheet.com/
https://www.youtube.com/watch?v=LPGBIjRrK4Q&t=8s&ab_channel=JanKoch
@alexjaw
alexjaw / decode_c_structs.py
Created March 17, 2022 08:13
Code example for how to decode c structs
# See also
# https://docs.python.org/3/library/struct.html#format-strings
# https://stackoverflow.com/questions/17244488/reading-struct-in-python-from-created-struct-in-c
'''
// Create c struct
#include <stdio.h>
typedef struct { char c; double v; int t;} save_type;
int main() {
// 1 + 8 + 4 = 13 bytes
// 1+7 + 8 + 4+4 = 24 bytes since we are on a 64-bit machine
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# Original file from ssdlite_mobilenet_v2_coco_2018_05_09, http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz
# Modified for detection of fruits, https://github.com/sayakpaul/E2E-Object-Detection-in-TFLite/blob/master/colab_training/Training_MobileDet_Custom_Dataset.ipynb
model {
ssd {
num_classes: 3
image_resizer {
fixed_shape_resizer {
height: 300
width: 300
}
@alexjaw
alexjaw / repeat.sh
Created August 12, 2020 11:54
How to repeat a cmd using bash
#! /usr/bin/env bash
# Example
# $ ./repeat.sh 2 date 1
# i = 2
# c = date
# s = 1
i=$1 # iterations
c=$2 # cmd to run
s=$3 # sleep time
@alexjaw
alexjaw / Notes
Last active September 8, 2019 15:01
QGIS Cykelkarta Lund
Importera data från lastkajen 5.10 (https://lastkajen.trafikverket.se/) till QGIS 3.4.
Från lastkajen laddade jag ner filen för Lund, Lunds kommun GeoDb_GeoDatabas__2975.zip. Innehåller en mdb fil. Import av databasfilen till QGIS skedde mha instruktion från https://www.northrivergeographic.com/qgis-accessing-personal-geodatabase. Det kanske finns ett bättre sätt? I vilket fall så får man möjlighet att välja olika lager som finns i mdb-filen. Ett av dessa är C-Cykelled. I QGIS kan man bla, efter import, undersöka olika egenskaper hos befintliga objekt (olika cykelsträckor i det här fallet).
#Att göra
- webpublicering. se http://www.qgistutorials.com/en/docs/web_mapping_with_qgis2web.html, https://learning.oreilly.com/library/view/learn-qgis-/9781788997423/a4004d8b-9ffa-4121-bf80-2143d48f38b6.xhtml
/*
* Si5340 Rev D Configuration Register Export Header File
*
* This file represents a series of Silicon Labs Si5340 Rev D
* register writes that can be performed to load a single configuration
* on a device. It was created by a Silicon Labs ClockBuilder Pro
* export tool.
*
* Part: Si5340 Rev D
* Design ID: 5340EVB1
@alexjaw
alexjaw / main.xc
Created March 28, 2018 08:55
xCORE-200 Multichannel Audio Platform simple gpio 1
/*
Simple gpio is based on xmos an00155 for xCORE-200 eXplorerKIT.
Here, I'm applying the code on MCA.
Observe that instead of using the led matrix on MCA, I'm using
a single bit port normally used for OPT_RX (which I monitor
with an oscilloscope).
I have built with unchanged Makefile Target, i.e. xCORE-200 Explorer Kit
@alexjaw
alexjaw / alexa.txt
Last active March 20, 2018 08:21
Alexa stuff
Swedish radio app
https://www.amazon.com/Sveriges-Radio-Listen-to-Swedish/dp/B01N99UOCM
Add spotify to alexa if you are not US citizen
https://community.spotify.com/t5/Accounts/Spotify-and-Echo-dot/td-p/1610240