Skip to content

Instantly share code, notes, and snippets.

View eip's full-sized avatar

Ed Popsuev eip

  • Ukraine
View GitHub Profile
; Start G-Code
G21 ;set units to millimeters
G90 ;use absolute positioning
M104 S{material_print_temperature_layer_0} ;set extruder temp
M140 S{material_bed_temperature_layer_0} ;set bed temp
G28 ;Home all axes
;G1 Z5.0 ;move platform down 5mm ;off for 2.0.3 firmware
G1 X0 Y20 F5000.0 ;move to intro line start position
M190 S{material_bed_temperature_layer_0} ;wait for bed temp
M109 S{material_print_temperature_layer_0} ;wait for extruder temp
@eip
eip / get_dashboards.go
Created February 26, 2021 15:55
Save Grafana Dashboards to files
// go build get_dashboards.go
// GF_HOST='localhost:3000' GF_API_KEY='#####' ./get_dashboards
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
@eip
eip / Color Sorting.ipynb
Created May 6, 2020 23:57
Color sorting examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eip
eip / round-numbers-test.js
Last active March 8, 2018 13:53
Round (decimal adjustment) of the numbers test and performance
/* eslint no-bitwise: "off", no-plusplus: "off", no-console: "off", no-unused-vars: warn */
const Benchmark = typeof window === 'object' ? window.Benchmark : require('benchmark'); // https://benchmarkjs.com
function roundFn01(value, precision) { // Simple version
const mult = +`1e${~~+precision || 0}`;
const v = +value;
return Number.isNaN(v) ? NaN : Math.round((v || 0) * mult) / mult;
}
function roundFn02(value, exp) { // Original MDN version
@eip
eip / main.js
Created October 6, 2017 15:06
Promises example: Race to success
// Logging helpers
var _startTime;
function _log() { // calling: _log.apply(console.log, arguments);
var nowTime = new Date();
var args = Array.prototype.slice.call(arguments, 0);
// var log = args.pop();
if (!_startTime) _startTime = nowTime;
args.unshift((' ' + (nowTime - _startTime)).slice(-5), 'ms:');
@eip
eip / tg_send.vbs
Last active November 11, 2019 01:40
Send messages via Telegram Bot API
Option Explicit
Public Function StrFormat(format, arguments())
Dim value, num
StrFormat = format
num = 0
For Each value In arguments
StrFormat = Replace(StrFormat, "{" & num & "}", value)
num = num + 1
Next
@eip
eip / vscenter_aclass.sql
Last active June 13, 2017 11:31
2017-02-03
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table blog
@eip
eip / JSON To CLR.applescript.js
Created July 27, 2016 20:08
Convert JSON to Apple Color List (.CLR)
var app;
var clrFilePath;
var colorCnt = 0;
var colorList;
var jsonFilePath;
var nsColorList;
var paletteName;
function hex2rgba(color) {
function ch(pos) {
@eip
eip / CLR To JSON.applescript.js
Last active April 14, 2022 01:26
Convert Apple Color List (.CLR) to JSON
var app;
var clrFilePath;
var colorList = {};
var jsonFilePath;
var nsColorList;
var nsStringColorList;
var paletteName;
function c2h(colorValue) {
return ('0' + Math.round(colorValue * 255).toString(16)).slice(-2);
@eip
eip / Default (OSX).sublime-keymap
Last active June 9, 2018 10:07
Sublime Text 3: keyboard shortcut for syntax (scope) specific beautify command
[{
"keys": ["super+shift+h"],
"command": "eip_beautify",
"args": {"command": "cd \"{dir}\" && js-beautify --js --replace \"{file}\""},
"context": [{"key": "selector", "operand": "source.js", "operator": "equal"}]
}, {
"keys": ["super+shift+h"],
"command": "eip_beautify",
"args": {"command": "cd \"{dir}\" && js-beautify --css --replace \"{file}\" && csscomb \"{file}\""},
"context": [{"key": "selector", "operand": "source.css", "operator": "equal"