Skip to content

Instantly share code, notes, and snippets.

// hide all
datasheets = $('.datasheet.pagebreak')
for (let i = 0; i < datasheets.length; i++) {
datasheets[i].style.setProperty('display', 'none');
datasheets[i].style.setProperty('margin-bottom', '6px');
}
// make content overview noprint
$('.contents_header')[0].parentNode.parentNode.classList.add("noprint");
// remove br and h2
@jethroo
jethroo / gist:e019f174c1a72b88493d8d277f44a82a
Created November 15, 2021 14:38
elasticsearch 7 mac issues
$ elasticsearch --v
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
error:
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
@jethroo
jethroo / listing_bl_crowdfunding_projects_with_lego_id.js
Created July 1, 2021 21:11
listing_bl_crowdfunding_projects_with_lego_id.js
//visit https://www.bricklink.com/v3/designer-program/introducing.page
//and type this in the console:
blapp.models.models.models.map(function(e) {
e = 'Model: ' + e.strModelName + ' LegoProductId: ' + e.nLegoProductId;
return e;
});
//you will get the projects infos:
Array(31) [ "Model: 1950s Diner LegoProductId: 0", "Model: Train Station: Studgate LegoProductId: 0", "Model: Kakapo LegoProductId: 910017", "Model: Seasons in Time: Calendar LegoProductId: 0", "Model: Quest Builder LegoProductId: 0", "Model: Castle in the Forest LegoProductId: 910001", "Model: Winter Chalet LegoProductId: 0", "Model: Working Waterfall LegoProductId: 0", "Model: Venetian Houses LegoProductId: 0", "Model: The Dive Shop LegoProductId: 0", … ]
0: "Model: 1950s Diner LegoProductId: 0"
1: "Model: Train Station: Studgate LegoProductId: 0"
@jethroo
jethroo / table_size.sql
Last active February 25, 2021 09:08
Getting table size MB in MySQL for a specific schema
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "<schema_name>"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
@jethroo
jethroo / simple curl load test
Created February 18, 2020 15:40
simple curl load test
#!/bin/bash
curling(){
echo "curling" $1
curl <whatever you want to curl>
}
# For loop 50 times
for i in {1..50}
do
function ruby_v() {
if [ -n "$(ls -A ./Gemfile 2>/dev/null)" ]
then
echo "${$(ruby_prompt_info)/ruby-/ }"
fi
}
function fg_c_code() {
echo "\\033[38;5;$1m"
}
@jethroo
jethroo / .bashrc
Last active February 22, 2019 20:08
COLUMNS=250
NORMAL="\[\033[00m\]"
YELLOW="\[\033[33m\]"
RED="\[\033[31m\]"
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "⚡️"
}
@jethroo
jethroo / app.js
Created February 15, 2017 15:59 — forked from davidkpiano/app.js
Simple way to namespace React components
import React from 'react';
import * as My from './components/my-components.js';
export default class App extends React.Component {
render() {
return (
<div>
<My.Foo />
<My.Bar />
@jethroo
jethroo / tz_identifiers_to_rails_identifiers.rb
Created June 29, 2016 16:16 — forked from jpmckinney/tz_identifiers_to_rails_identifiers.rb
Maps tz database time zone identifiers to Rails time zone identifiers
# blog post: http://blog.slashpoundbang.com/post/2613268281/changing-from-tz-database-identifiers-to-rails-friendly
{
"Australia/Adelaide" => "Adelaide",
"Australia/Broken_Hill" => "Adelaide",
"America/Anchorage" => "Alaska",
"America/Juneau" => "Alaska",
"America/Nome" => "Alaska",
"America/Yakutat" => "Alaska",
"Pacific/Gambier" => "Alaska",
"Asia/Almaty" => "Almaty",