Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ralphtheninja's full-sized avatar
🏠
Working from home

ralphtheninja

🏠
Working from home
View GitHub Profile
@ralphtheninja
ralphtheninja / cleanup_docker.sh
Created December 22, 2016 23:05 — forked from jaronkk/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.
@ralphtheninja
ralphtheninja / storage.js
Created February 1, 2022 23:21
mixmap storage wrapper
/**
* Storage wrapper object for relaying operations to backend.
*/
module.exports = function (backend) {
var storageFn = function (name) {
return {
write: function (offset, buf, cb) {
cb(new Error('write not implemented'))
},
truncate: function (length, cb) {
@ralphtheninja
ralphtheninja / JOBS.md
Last active April 28, 2021 00:38
Use JOBS=max to speed up native node modules

When npm installs native node modules it uses node-gyp to compile code. This is the seam node uses for targeting different operating systems, e.g. OS X, linux, Windows etc.

By default node-gyp compiles using one core and if you have more than one you probably want to utilize that power to speed up compile time. The way node-gyp handles this is by using the JOBS environment variable, which sets the jobs variable here. This piece of code then checks the value of jobs to determine how many cores to use.

Note that if the value of JOBS is max then all cores will be used. So lets try this on leveldown. First lets check that JOBS isn't set yet:

lms@ux301|01:34|~/src/leveldb-repos/leveldown (master) $ echo $JOBS

1. build pktd (to get pktwallet and pktctl)

https://docs.pkt.cash/en/latest/pktd/#installation

2. run the wallet

Note, this will ask you questions the first time. Input wallet passphrase and write down mnemonic for wallet recovery.

./pktd/bin/pktwallet
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC5Hi4F9oI7/3D8oQQmM1TrIgPTYpTPbUp3lvc00xffUCfQB9npQXSoxZPaeuKYlVU+CXpvge0jKr9KottPgLvMbqJLZ3lacZNW33tcqDfv/UjJoPUVd1zQUww1MW+xp2ktsu19SwCvBYNjtHAFo0r95KnCMPyDh13vLmtaixgsQBCdhbq4qbWoI5ELDHYzNnuqTHCB2e1YClM5DBkIHj1Iq+lsSnH8Pd/oM4GiRFIE3nC/m5VDDB/29YQNKU4Wx7fKgtPsUnOEQYsA7gbRL3Ac12NOYfeim+vKVaxNn9B8NUOhgpYa3iTV0vjsfZnCgJW/QEqkgWmSXvys5ZldlhcOGqyW08yz3zPAAoEjhzemYmbj+BKca0z8xidZZo/+EEBmWc6M9s2/q3Hy0uj7ZhV8+RTbmwkUc437n/faAN5DQQGIQWQMw2BeETXjOmFMoSpoX+drAbfaboPJbRveG2nMTekQOc+lkEaTSyEEDeHW306KR6NTY6EqHPQebOoSU9tgEBeA3CqPMmd7VqeyNfAr7pWyhcaGWPxYKYSCcOms6vEZOO8ICO72cffrWRJnNhHmYwvThirtuJiloLAJQT5B9q/ayhsageexPm6mGgfjPx30thb4dgEO66f/KO+Bzvvf6CHPeK2jiGR5k2XylMWT78eQ64QjA7W17H7SwHBtcQ== lms@x260
@ralphtheninja
ralphtheninja / clean-up-boot-partition-ubuntu.md
Created October 28, 2019 22:36 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
if !pathNfilename_abs.is_null() {
let path = std::path::Path::new(
std::ffi::CStr::from_ptr(pathNfilename_abs)
.to_str()
.unwrap(),
);
match fs::canonicalize(path) {
Ok(v) => {
return to_cstring(v.to_str().unwrap());
}
cd deltachat-node
cd deltachat-core-rust
git fetch
git checkout --track origin/cleanup-cli
git rebase origin/master
cd ..
node scripts/rebuild-core.js
./node_modules/.bin/node-gyp rebuild
cp deltachat-core-rust/target/release/deltachat.dll build/Release
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 2532, error_len: Some(1) }', src/libcore/result.rs:999:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook