Skip to content

Instantly share code, notes, and snippets.

@apla
apla / gpio
Last active June 15, 2019 23:45
OrangePI protobor display monitor code
#!/bin/bash
cmd=$1
pin=$2
mode=$3
value=$3
pin_num=
@apla
apla / macOS.txt
Created May 2, 2019 07:42
node_exporter output
## curl http://127.0.0.1:9100/metrics
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
@apla
apla / ls
Created July 22, 2018 07:55
how apple handles incorrect permissions
ls -la /usr/local/
total 8200
drwxr-xr-x 15 root wheel 480 Jan 23 16:47 .
drwxr-xr-x@ 11 root wheel 352 Jul 11 00:54 ..
-rw-r--r-- 1 user wheel 0 Jul 22 03:20 .com.apple.installer.keep
drwx------ 72 user staff 2304 Jul 22 03:55 Cellar
drwxr-xr-x 4 user admin 128 Mar 7 23:25 Frameworks
drwxrwxr-x 17 user admin 544 Jul 19 09:15 Homebrew
drwxrwxr-x 466 user admin 14912 Jul 22 03:55 bin
-rw-r--r-- 1 root wheel 3970951 Apr 15 08:49 createnetwork.log
@apla
apla / clone.sh
Last active June 17, 2019 20:21
Linux clone disk
#!/bin/bash
# parted --list
sudo lsblk -o name,mountpoint,parttype,partlabel,label,size,uuid
DISKS=( $(lsblk --nodeps -n -o name) )
read -e -p "Source disk: " -i "sda" FROM
read -e -p "Destination disk: " -i "sdb" TO
@apla
apla / a.bash
Created September 30, 2017 22:37
macOS Library/Mail account identifiers to username conversion
ls -1 ~/Library/Mail/V5 | xargs -I {} sqlite3 -noheader -column ~/Library/Accounts/Accounts4.sqlite "select ZIDENTIFIER || ' => ' || ZUSERNAME || '/' || ZACCOUNTDESCRIPTION || ' ACTIVE: ' || ZACTIVE from ZACCOUNT where ZIDENTIFIER = '{}'"
@apla
apla / INDEX.md
Last active February 14, 2017 09:59
cnc

Preview:

  1. Copy jscad file contents to the OpenJSCad.org

Prepare and edit:

  1. Download and install Atom editor
  2. Launch Atom, then go to the plugins, search and install atom-jscad package
  3. Save all the files from this gist to the folder on your computer
  4. Open folder with Atom editor
@apla
apla / index.css
Created December 31, 2016 00:14
test for a linked graphs
.shadergraph-graph {
font: 12px sans-serif;
line-height: 25px;
position: relative;
}
.shadergraph-graph:after {
content: ' ';
display: block;
height: 0;
font-size: 0;
@apla
apla / build-chromium-windows.bat
Last active May 9, 2023 15:00
Build CEF# from source with mp4
@echo off
REM instructions from: https://groups.google.com/d/msg/cefsharp/BJLMXl9c204/HMJlp8mZzF0J
REM seems like partial instructions copied to SO: http://stackoverflow.com/questions/8033495/chromium-embedded-framework-mp3-support
REM all chromium releases: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md#markdown-header-release-branches
REM 2272 - latest chromium with npapi (41)
REM there is a commits list: https://bitbucket.org/chromiumembedded/cef/branch/2272
REM https://github.com/cefsharp/CefSharp
REM cef builds http://www.magpcss.net/cef_downloads/
REM https://cefbuilds.com
@apla
apla / index.html
Created January 24, 2016 14:10
base mocha reporter for browser test
<html>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.min.js"></script>
<script type="text/javascript">
function reporter (runner) {
var stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
var failures = this.failures = [];
if (!runner) {
return;
@apla
apla / basic.proto
Created January 15, 2016 07:00
protocol-buffers error
package BasicProtobuf;
message ConnectionResponse
{
required ResponseCode responseCode = 1;
required string sessionId = 2;
optional string message = 3;