Skip to content

Instantly share code, notes, and snippets.

@tucanae47
tucanae47 / artywblitex.py
Last active September 21, 2020 15:29
arty wishbone uart bridge
from litex.soc.cores import uart
from litex.soc.cores.uart import UARTWishboneBridge
from litex_boards.platforms import arty
from litex_boards.targets.arty import BaseSoC
from litex.soc.integration.builder import Builder
class BridgeSoC(BaseSoC):
def __init__(self, platform, *args, **kwargs):
@tucanae47
tucanae47 / artywb.py
Created September 19, 2020 16:30
wishbone example
import argparse
import importlib
from nmigen_boards.arty_a7 import *
from nmigen import *
from nmigen_soc import wishbone
from uartbridge import UARTBridge
from lambdasoc.periph.sram import SRAMPeripheral
__all__ = ["ArtyWB"]
use async_std::task;
use in3::prelude::*;
fn main() {
// configure client and API
let mut eth_api = Api::new(Client::new(chain::MAINNET));
// Setup Incubed contract address
let contract: Address =
serde_json::from_str(r#""0x2736D225f85740f42D17987100dc8d58e9e16252""#).unwrap(); // cannot fail
// Instantiate an abi encoder for the contract call
[package]
name = "in3-tutorial"
version = "0.0.1"
authors = ["[email protected]"]
[dependencies]
in3 = "0.0.2"
serde_json = "1.0"
async-std = "1.5.0"
extern crate in3;
use async_std::task;
use in3::prelude::*;
use in3::ipfs::*;
fn main() {
let mut ipfs_api = Api::new(Client::new(chain::IPFS));
//`put` is an asynchrous request (due to the internal C library). Therefore to block execution
//we use async_std's block_on function
@tucanae47
tucanae47 / request.sh
Created February 11, 2017 13:58 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@tucanae47
tucanae47 / NASA Picture-Of-The-Day Wallpaper Script
Created September 23, 2016 13:34 — forked from JoshSchreuder/NASA Picture-Of-The-Day Wallpaper Script
A BASH script to download NASA's picture of the day (http://apod.nasa.gov/apod/astropix.html) automatically saving and setting as wallpaper and saving optional description of image to text.
#!/bin/bash
# Copyright (c) 2011 Josh Schreuder
# http://www.postteenageliving.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@tucanae47
tucanae47 / bootstrap_homeshick.sh
Created August 30, 2016 20:06 — forked from andsens/bootstrap_homeshick.sh
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@tucanae47
tucanae47 / trackpkg.py
Last active August 29, 2015 14:14
Tracking package numbers easy way
#required.... you will find out fast in google :P.... any question is welcome. cmsvalenzuela at gmail
import smtplib
from rq_scheduler import Scheduler
from datetime import datetime, timedelta
from redis import Redis
import re, requests, json
import json,sys