Skip to content

Instantly share code, notes, and snippets.

View meriororen's full-sized avatar
🎯
Focusing

Isa Ansharullah meriororen

🎯
Focusing
  • PT Hardtmann Mekatroniske Indonesia
  • Jakarta, Indonesia
View GitHub Profile
@meriororen
meriororen / protecc.sh
Created September 7, 2020 10:39
protect and unprotect all master branches in a group
#!/bin/bash
all_project_ids=`curl --header "PRIVATE-TOKEN: ${gitlab_access}" \
"https://gitlab.com/api/v4/projects?membership=true&simple=true&per_page=100" | jq '.[] | select(.path_with_namespace|test("'${filter}'")) | .id'`
if [ "$1" == "protect" ]; then
# protecc
for i in $all_project_ids; do
curl --request POST --header "PRIVATE-TOKEN: ${gitlab_access}"\
"https://gitlab.com/api/v4/projects/${i}/protected_branches?name=master&push_access_level=30&merge_access_level=30&unprotect_access_level=40"
done
@meriororen
meriororen / force_retry.sh
Created September 7, 2020 10:36
Force retry last job in gitlab projects
#!/bin/bash
all_project_ids=`curl -s --header "PRIVATE-TOKEN: ${gitlab_access}" \
"https://gitlab.com/api/v4/projects?membership=true&simple=true&per_page=100" | jq '.[] | select(.path_with_namespace|test("'${filter}'")) | .id'`
echo $all_project_ids
for i in $all_project_ids; do
last_job=`curl -s --globoff --header "PRIVATE-TOKEN: ${gitlab_access}" "https://gitlab.com/api/v4/projects/${i}/jobs" | jq '.[0] | select(.id != null) | .id'`
if [ "$last_job" != "" ]; then
echo "retrying job id: $last_job"
@meriororen
meriororen / Dockerfile
Created September 3, 2020 03:44
Setup ssl termination for local dockerized environment
FROM nginx:1.19
COPY *.pem /etc/nginx/certs/
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 443
ENTRYPOINT ["nginx", "-g", "daemon off;"]
@meriororen
meriororen / Deployment
Created June 14, 2020 13:09
FTW deployment
# Run this on ubuntu or debian
1. Install Docker
2. Install Docker-Compose
3. Pull https://gitlab.com/hardtmann/fit-to-work-web
4. Open prepare.sh
5. Modify all devices' Vendor ID and Product ID, and save
6. Run prepare.sh with sudo
7. If all is well, when you connect any of the devices, you should see 'tempdev, hbpdev, or pulseoxidev' under /dev
8. Open docker-compose.yml, set "TEMPDEV_ENABLED, HBPDEV_ENABLED, PULSEOXIDEV_ENABLED" to either true or false, depending on your need
@meriororen
meriororen / shadow.yml
Last active November 10, 2019 23:52
public
version: '2'
services:
shadow_tmp:
image: registry.gitlab.com/dekape/shadow/shadow:latest
container_name: shadow_tmp
environment:
- RUN_AS_TEMPORARY_CONTAINER=true
privileged: true
volumes:
@meriororen
meriororen / Huawei.md
Last active October 2, 2019 11:16
Running huawei modem
// mmcli must be available
// if not, install using snap install modem-manager
$ mmcli -L  ;; check listed modem
$ mmcli -m x ;; x is modem id listed

// use nmcli (network manager) to setup
$ nmcli c add type gsm ifname <port> con-name <arbitrary> apn <apn url>
$ nmcli r wwan on ;; setup wwan to on
@meriororen
meriororen / ch375b_snippet.c
Created September 24, 2018 09:16
ch375b test code snippet
int do_once = 0;
typedef struct __attribute__((__packed__)) {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t bcdUSB;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
@meriororen
meriororen / Dockerfile
Last active July 19, 2018 03:32
Dockerfile for nrfbleprinter environment
FROM ubuntu
MAINTAINER Isa Ansharullah <isa.ansharullah@bukalapak.com>
RUN apt-get update
RUN apt-get install -y python
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
RUN apt-get update
RUN apt-get install -y gcc-arm-embedded
@meriororen
meriororen / logo.h
Created June 25, 2018 06:52
logobukalapak
//------------------------------------------------------------------------------
// File generated by LCD Assistant
// http://en.radzio.dxp.pl/bitmap_converter/
//------------------------------------------------------------------------------
const unsigned char logo_bukalapak [] = {
#if 0
0x00,
#else
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,