Skip to content

Instantly share code, notes, and snippets.

Avatar

Salamandar Salamandar

View GitHub Profile
@Salamandar
Salamandar / record_ram_usage.sh
Created January 20, 2023 12:37
Record ram usage
View record_ram_usage.sh
#!/bin/bash
ram_usage() {
free -m | grep Mem | awk '{print $3}'
}
base=$(ram_usage)
max=0
while true; do
@Salamandar
Salamandar / import_apps.py
Last active January 20, 2023 12:15
Import json to Fider via SQL queries. import_apps should be called first, then the list could be reviewed, then imported via import_apps.py.
View import_apps.py
#!/usr/bin/env python3
import re
import json
import yaml
import psycopg2
def connect_db():
hostname = "localhost"
@Salamandar
Salamandar / serial_duplicator.py
Created March 23, 2022 08:52
Duplicate TTY serial port using socat in Python to log everything that goes through it.
View serial_duplicator.py
#!/usr/bin/env python3
import sys
import os
import signal
import threading
import subprocess
from typing import Optional
from pathlib import Path
@Salamandar
Salamandar / local_prefix_variables
Created July 7, 2020 13:14
Export all useful variables for a local prefix, with development tools.
View local_prefix_variables
# This file expects LOCAL_PREFIX to be an absolute path to the prefix (like /usr or $HOME/.local)
export PATH="${LOCAL_PREFIX}/bin:${PATH}"
# Used to detect the build dependencies
export PKG_CONFIG_PATH="${LOCAL_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH="${LOCAL_PREFIX}/lib64/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH="${LOCAL_PREFIX}/share/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH="${LOCAL_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
@Salamandar
Salamandar / crosstool-config
Created April 2, 2020 18:42
Crosstool configuration
View crosstool-config
#
# Automatically generated file; DO NOT EDIT.
# crosstool-NG aca85cb Configuration
#
CT_CONFIGURE_has_static_link=y
CT_CONFIGURE_has_wget=y
CT_CONFIGURE_has_curl=y
CT_CONFIGURE_has_stat_flavor_GNU=y
CT_CONFIGURE_has_make_3_81_or_newer=y
CT_CONFIGURE_has_libtool_2_4_or_newer=y
@Salamandar
Salamandar / svg2dxf.sh
Created February 25, 2020 07:44
svg to dxf conversion
View svg2dxf.sh
#!/bin/bash
# The assert function for Bash
function assert {
local rc
local message="$1"
shift
"$@" 2>&1 > /dev/null
rc=$?
[ $rc -eq 0 ] && return 0
set $(caller)
@Salamandar
Salamandar / kicad_generate_gerber.py
Last active October 18, 2020 20:30
Python script that generates Gerber, Drill map, Position file, and zips everything.
View kicad_generate_gerber.py
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Salamandar <felix@piedallu.me> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Félix Piédallu
# ----------------------------------------------------------------------------
import sys
View keybase.md

Keybase proof

I hereby claim:

  • I am salamandar on github.
  • I am testdokan (https://keybase.io/testdokan) on keybase.
  • I have a public key ASDSJccNDqq6xX-6KFH-U_-si22H2FUXjQmOsQjKhA6QDQo

To claim this, I am signing this object:

@Salamandar
Salamandar / clone_or_pull_all.sh
Last active October 20, 2018 13:34
clone_or_pull_all.sh
View clone_or_pull_all.sh
#!/bin/env python3
import requests
import json
import os
# user_path='users/salamandar'
user_path = 'orgs/phenixrobotik'
clone_dir = os.path.dirname(os.path.realpath(__file__))
use_ssh = True