Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I'm upto something

kost kost

💭
I'm upto something
View GitHub Profile
View f32c.ys
ghdl --ieee=synopsys -fexplicit -frelaxed-rules --std=08 \
../../../../lattice/ulx3s/top/top_ulx3s_12f_xram_sdram.vhd \
../../../../lattice/ulx3s/clocks/clk_25_78_125_25.vhd \
../../../../lattice/ulx3s/clocks/clk_25_100_125_25.vhd \
../../../../lattice/ulx3s/clocks/clk_25_125_250_25_83.vhd \
../../../../lattice/ulx3s/clocks/clk_25_250_125_25_100.vhd \
../../../../lattice/ulx3s/clocks/clk_25_125_25_48_89.vhd \
../../../../lattice/ulx3s/clocks/clk_25_125_25_48_104.vhd \
../../../../lattice/ulx3s/clocks/clk_25_325_25_81.vhd \
../../../../lattice/ulx3s/clocks/clk_25_325_25_92.vhd \
@kost
kost / web-servers.md
Created Apr 2, 2020 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@kost
kost / SimpleHTTPServer.cs
Created Apr 2, 2020 — forked from aksakalli/SimpleHTTPServer.cs
SimpleHTTPServer in C#
View SimpleHTTPServer.cs
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
@kost
kost / 25to12.sh
Last active Feb 2, 2020
ECP5 - repack 25f bitstream file to 12f
View 25to12.sh
#!/bin/sh
# Repack 25f to 12f bitstream file.
# Usage: script <input> <output>
TMPECP5CONFIG=`mktemp`
ecpunpack --input "$1" --textcfg "$TMPECP5CONFIG" --idcode 0x41111043
ecppack --compress --input "$TMPECP5CONFIG" --bit "$2" --idcode 0x21111043
rm -- "$TMPECP5CONFIG"
@kost
kost / serialecho.py
Created Jan 28, 2020
Serial Echo in MicroPython
View serialecho.py
from time import sleep_ms
from machine import UART
def serialecho():
print("serial echo server started")
uart = UART(2) # 16:RX 17:TX
uart.init(baudrate=115200, bits=8, parity=None, stop=1)
while True:
if uart.any():
x=uart.read()
View ulx3s_buildenv.sh
#!/bin/sh
# Create symlink farm for emard make files.
ECPBINSDIR=$(dirname `which ecppack`)
mkdir -p /mt/scratch/tmp/openfpga/vhd2vl/src
ln -sf `which vhd2vl` /mt/scratch/tmp/openfpga/vhd2vl/src/vhd2vl
mkdir -p /mt/scratch/tmp/openfpga/yosys
ln -sf `which yosys` /mt/scratch/tmp/openfpga/yosys/yosys
mkdir -p /mt/scratch/tmp/openfpga/nextpnr
View copy_bios_end.sh
#!/bin/sh
# Copy data to the end of the partition, needed for BIOS Next186 by Kost.
# https://gist.github.com/kost
# Example: ./copy_bios_end.sh BIOS_Next186.bin /dev/sdd
if [ "$#" -ne 2 ] ; then
echo "Usage: $0 <BIOSfile> <device>" >&2
echo "Example: $0 BIOS_Next186.bin /dev/sdd" >&2
exit 1
fi
View platform_check_v36.diff
--- platform_check.orig 2019-12-23 15:34:28.380333391 +0000
+++ platform_check 2019-12-23 15:35:50.004593076 +0000
@@ -12,15 +12,7 @@
case $PLATFORM in
linux | linux_a_64 )
case $VERSION in
- 5.*)
- fullsubver=`echo $VERSION | sed s/5\\\.//`
- numsubver=`echo $fullsubver | sed -e 's/[^0-9].*//'`
- if [ $numsubver -gt 8 ]; then
View platform_check.diff
--- platform_check.orig 2019-12-23 10:38:37.554904368 +0000
+++ platform_check 2019-12-23 10:39:31.407644807 +0000
@@ -12,7 +12,7 @@
case $PLATFORM in
linux | linux_a_64 )
case $VERSION in
- 3.* | 2.4.* | 2.6.* )
+ 5.* | 4.* | 3.* | 2.4.* | 2.6.* )
PLATFORM_STATUS="ok";;
*)
@kost
kost / test-sizes.c
Created Dec 11, 2019
Test sizes of primitives on different archs
View test-sizes.c
#include <stdio.h>
main()
{
fprintf(stdout, "size of char: %d\n", sizeof(char));
fprintf(stdout, "size of short: %d\n", sizeof(short));
fprintf(stdout, "size of int: %d\n", sizeof(int));
fprintf(stdout, "size of char_p: %d\n", sizeof(char *));
}
You can’t perform that action at this time.