Skip to content

Instantly share code, notes, and snippets.

@v3rm0n
v3rm0n / auto_reboot.sh
Created March 13, 2023 12:01
Reboot server on connectivity loss
#!/bin/bash
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
((count = 10)) # Maximum number to try.
autoreboot_log="/var/log/autoreboot.log"
echo $(date -u) "Current time: $(date)" >> "$autoreboot_log"
@v3rm0n
v3rm0n / bassdrive.lua
Last active October 25, 2022 08:53
Bassdrive VLC Extension
local json = nil
local dayOrder = {'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'}
function descriptor()
return { title = "Bassdrive Radio", capabilities = {} }
end
function indexOf(array, value)
for i, v in ipairs(array) do
if v == value then
// ==UserScript==
// @name OnVoteMoveDownReddit
// @description Simple script that allows using a/z for voting and on vote will move to next element and expand it in Reddit. x will expand the thing if it is not already expanded. When at the end of the page, new content is loaded automatically
// @exclude https://old.reddit.com/r/*/comments/*
// @match https://old.reddit.com/r/*
// @match https://old.reddit.com/
// ==/UserScript==
// CSS for the active thing
const style = document.createElement("style");
#!/bin/bash -eo pipefail
flutter -v test --coverage
[  +45 ms] executing: [/home/cirrus/sdks/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +49 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/master
[        ] executing: [/home/cirrus/sdks/flutter/] git rev-parse --abbrev-ref HEAD
[  +10 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[        ] executing: [/home/cirrus/sdks/flutter/] git ls-remote --get-url origin
fun MessageChannel.sendMessage(o: Any): Boolean {
return this.send(MessageBuilder.withPayload(o).build())
}
// Usage
val mailMessageChannel // A MessageChannel instance
fun sendEmail(message: Message) {
mailMessageChannel.sendMessage(message)
}
class OrderBuilder {
var id: Long = Random().nextLong()
var userId = 1L
var from = 100.btc
var to = 10.ltc
var rate = 0.5
var status = NEW
private fun build() = Order(id, userId, from, to, rate, status)
val user: User?
// Get user ID
//If expression (userId is nullable)
val userId = if(user != null) user.id else null
//Elvis operator (userId is not nullable, fail fast)
val userId = user.id ?: throw IllegalStateException("User can not be null at this time")
@v3rm0n
v3rm0n / gist:c2f967c979f5edab3c112a59e48aec45
Last active January 3, 2018 07:16
Change Finance Test Fee wallet
0x52423dc2162e4a82ae2fc74d0f51dbd29baf0f2a

Keybase proof

I hereby claim:

  • I am v3rm0n on github.
  • I am maido (https://keybase.io/maido) on keybase.
  • I have a public key whose fingerprint is 6F6B C310 7A47 C258 4430 80B9 C2D4 29D4 E7A3 E875

To claim this, I am signing this object: