Skip to content

Instantly share code, notes, and snippets.

@gad0lin
gad0lin / Channel.js
Created May 29, 2019 18:29
hyperledger channel.js troubleshooting
const {parse, stringify} = require('flatted/cjs');
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
# install libglvnd
# if you saw error:
# An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries.
apt-get install dh-autoreconf libxext-dev libx11-dev x11proto-gl-dev
git clone https://github.com/NVIDIA/libglvnd.git
cd libglvnd
./autogen.sh
./configure
make
@gad0lin
gad0lin / errors catching async
Last active November 15, 2017 18:36
errors catching async
let b = async function() {
throw "bad"
}
let a = async function() {
try {
return b();
} catch (e) {
console.log(123)
}
netstat -nlp | grep 0.0.0.0:8080 | awk '{print $7}' | cut -d/ -f1
@gad0lin
gad0lin / rancher-host-issue_var_log_messages.txt
Last active February 14, 2017 02:00
rancher-host-issue_var_log_messages
Feb 14 01:34:00 staging-rh5 kernel: IPv6: eth0: IPv6 duplicate address fe80::44ae:f2ff:fe2d:2aed detected!
Feb 14 01:34:01 staging-rh5 systemd: Created slice user-0.slice.
Feb 14 01:34:01 staging-rh5 systemd: Starting user-0.slice.
Feb 14 01:34:01 staging-rh5 systemd: Started Session 484 of user root.
Feb 14 01:34:01 staging-rh5 systemd: Starting Session 484 of user root.
Feb 14 01:34:01 staging-rh5 logrotate: ALERT exited abnormally with [1]
Feb 14 01:34:01 staging-rh5 systemd: Removed slice user-0.slice.
Feb 14 01:34:01 staging-rh5 systemd: Stopping user-0.slice.
Feb 14 01:34:02 staging-rh5 kernel: XFS (dm-9): Mounting V5 Filesystem
Feb 14 01:34:02 staging-rh5 kernel: docker0: port 5(vethfdecd241) entered forwarding state
@gad0lin
gad0lin / no callback nodejs
Created December 29, 2016 19:27
no callback nodejs
var co = require('co'),
Agenda = require('agenda');
var check = function (queryName, checkCursor, done) {
console.log("1. this gets printed ...");
co(function*() {
try {
console.log("2. this gets printed");
const cursor = checkCursor;
for (let token = yield cursor.next(); token != null; token = yield cursor.next()) {
- shell: curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python
when: "{{ pip_version.stdout| ge_version('7.0.0') }} == False"
def ge_version(given, minimum_required):
if given == "":
return False
def versiontuple(v):
return tuple(map(int, (v.split("."))))
import pacparser
import urllib2
pac_url=""
response = urllib2.urlopen(pac_url)
f = open('proxy.pac', 'w')
f.write(response.read())
f.close()
pacparser.init()
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
class L2Switch(app_manager.RyuApp):
def __init__(self, *args, **kwargs):
super(L2Switch, self).__init__(*args, **kwargs)
#!/usr/bin/ruby
require 'open-uri'
str = ARGV[0]
p str
puts URI::encode(str)