Skip to content

Instantly share code, notes, and snippets.

(function confirmRiskItemChained($taskList_html = null) {
let taskList_url = 'personalManagement.do?action=listPersonalTask';
if (!$taskList_html)
$taskList_page = $(document);
else
$taskList_page = $($taskList_html);
if ($taskList_page.find('table#countTask1 tr td:nth-child(7) a').length == 0)
console.log('finished');
$.each($taskList_page.find('table#countTask1 tr td:nth-child(7) a'), function(i, elem) {
let task = $taskList_page.find('table#countTask1 tr td:nth-child(2)')[i].innerHTML.split(/\s+/).join(' ');
javascript:(function confirmAssetOnce() {
$.each($('table#countTask1 tr td:nth-child(7) a'), function(i, elem) {
task = $('table#countTask1 tr td:nth-child(2)')[i].innerHTML.split(/\s+/).join(' ');
if (task == localStorage.getItem('task')) {
location.reload();
return false;
}
localStorage.setItem('task', task);
console.log(`working on ${task}`);
$.get(elem.href, function(page) {
javascript:(function confirmAsset($taskList_html = null) {
let taskList_url = 'personalManagement.do?action=listPersonalTask';
jQuery.ajaxSetup({async:false});
if (!$taskList_html)
$taskList_page = $(document);
else
$taskList_page = $($taskList_html);
$.each($taskList_page.find('table#countTask1 tr td:nth-child(7) a'), function(i, elem) {
let task = $taskList_page.find('table#countTask1 tr td:nth-child(2)')[i].innerHTML.split(/\s+/).join(' ');
if (task == localStorage.getItem('task')) {
@ViKingIX
ViKingIX / find_ovs_port_by_ip.sh
Created March 10, 2022 06:18
prints ovs port info for given ip[s]
#!/bin/bash
function port_neutron_obj {
cat neutron_port.json | jq ".[] | select(.fixed_ips | contains(\"$1\"))"
}
function port_ovs_obj {
IND_EXT_IDS=$(cat ovs_port.json | jq '.headings | index("external_ids")')
IND_OFPORT=$(cat ovs_port.json | jq '.headings | index("ofport")')
IND_DEVNAME=$(cat ovs_port.json | jq '.headings | index("name")')
function lanip()
{
ip -4 addr show en6 | awk '/inet/ { print $2; }' | awk -F/ '{ print $1; }'
}
function gw() {
ip route | awk '/default/ { print $3; }'
}
function langw()

Solution to "device not detected" for ckb-next on MacOS Big Sur

  1. Reboot into Recovery mode and disable SIP(hold cmd + r when booting until a grey screen flash)
    csrutil disable
    
  2. Normal boot, a popup should prompt for allow loading kext
  3. Reboot into recovery mode and add kext team ID into whitelist
    spctl kext-consent add G43BCU2T37
    
@ViKingIX
ViKingIX / list_volumes_by_instance.sh
Created February 23, 2021 03:28
list instance volumes using openstack client from bash
#!/bin/bash
for prj in $(jq -r .[] projects.json)
do
instance_uuids=$(openstack server list -f json --project $prj | jq -r ".[].ID")
for instance_uuid in $instance_uuids
do
instance_json=$(openstack server show $instance_uuid -f json)
echo $instance_json | jq '{uuid: .id, instance: ."OS-EXT-SRV-ATTR:instance_name", volumes: ."os-extended-volumes:volumes_attached"}'
done
@ViKingIX
ViKingIX / list_server_volumes_by_project.py
Created February 23, 2021 03:25
List server and its volumes group by project with novaclient and cinderclient
#!/usr/bin/python3
import os
import json
from keystoneauth1.identity import v3
from keystoneauth1 import session
import novaclient.client
import cinderclient.client
import config
@ViKingIX
ViKingIX / .screenrc
Created June 6, 2019 02:42 — forked from amyreese/.screenrc
Screenrc vs tmux.conf
autodetach on
crlf off
startup_message off
shell -zsh
defmonitor on
activity "<%n>"
caption always "%{= dd}%{+b ky}%{+ .b} $LOGNAME@%H %{-} %{.y}%-w%50>%{+ Kg} %n %t %{-}%+w%<%{-}"
# 256 color support
attrcolor b ".I"
---
- hosts: test
remote_user: idc
become: yes
vars:
LOGIN_FAIL_LOCK_SECS: 1800
LOGIN_FAIL_MAX_COUNT: 3
PASS_HIST: 3
PASS_MIN_LEN: 12
SSH_ALIVE_INTERVAL: 600