Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️

Derry Pratama ibndias

🏖️
View GitHub Profile
@ibndias
ibndias / HowToOTGFast.md
Last active Feb 17, 2019 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!
View HowToOTGFast.md

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. Finally, open up the cmdline.txt. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single

@ibndias
ibndias / pizero_usb_internet.sh
Last active Dec 24, 2016 — forked from lurch/pizero_usb_internet.sh
Script to automatically provide internet access to a PiZero connected to a Linux host over a USB-network (only tested on Ubuntu 14.04)
View pizero_usb_internet.sh
#!/bin/bash
# Automatically setup routing and DNS for a PiZero connected over a USB-network
# NOTE: Before running this script for the first time, you need to run the
# following two commands on your Linux PC
# sudo sysctl -w net.ipv4.ip_forward=1
# sudo iptables -t nat -A POSTROUTING -s 169.254.0.0/16 -o eth0 -j MASQUERADE
# (replace eth0 in the second command with your internet-facing network device,
# e.g. wlan0 on a laptop)
# The Avahi-discovered hostname
@ibndias
ibndias / SimpleDemoGA.java
Created Mar 22, 2020 — forked from Vini2/SimpleDemoGA.java
A simple implementation of a genetic algorithm
View SimpleDemoGA.java
import java.util.Random;
/**
*
* @author Vijini
*/
//Main class
public class SimpleDemoGA {
View my-gcc-snippet
#Compile using custom linker file and generate map file
gcc hello.c -Wl,-T,hello.ld,-Map=hello.map
#Show current ld used by linker
ld -verbose
@ibndias
ibndias / RIMI Documentation.md
Last active Sep 16, 2021
RIMI: Instruction-level Memory Isolation for Embedded Systems on RISC-V Documentation
View RIMI Documentation.md
@ibndias
ibndias / Makefile
Created Aug 5, 2020 — forked from rsperl/Makefile
self-documenting makefile with colors
View Makefile
SHELL=/bin/bash
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
View engine.c
#include "openssl/engine.h"
#include "openssl/evp.h"
#include "rfc1321/global.h"
#include "rfc1321/md5.h"
#define MD5_DIGEST_LENGTH 16
#define MD5_CBLOCK 64
static const char *engine_id = "MD5";
static const char *engine_name = "A simple md5 engine for demonstration purposes";
@ibndias
ibndias / MachineFunctionPass-insert-MachineInstruction.patch
Created Aug 31, 2020
An LLVM Patch to add custom written MachineFunctionPass that writes MachineInstruction before each Call Instruction
View MachineFunctionPass-insert-MachineInstruction.patch
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index 9a0c2209c88..7dcbdc67f37 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -29,6 +29,7 @@ add_llvm_target(RISCVCodeGen
RISCVLegalizerInfo.cpp
RISCVMCInstLower.cpp
RISCVMergeBaseOffset.cpp
+ RISCVMachineInstrPrinter.cpp
RISCVRegisterBankInfo.cpp
@ibndias
ibndias / MachineFunctionPass.c
Last active Sep 1, 2020
Dummy RISCV LLVM Pass to Insert Machine Instruction before each Call instruction
View MachineFunctionPass.c
#include "RISCV.h"
#include "RISCVInstrInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
using namespace llvm;
#define RISCV_MACHINEINSTR_PRINTER_PASS_NAME \
"Dummy RISCV machineinstr printer pass"
@ibndias
ibndias / bti-build-instruction.sh
Last active Nov 16, 2020
bti-build-instruction.sh
View bti-build-instruction.sh
# Ubuntu, install prerequisites
sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
# Install RISCV toolchain
git clone https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
git submodule update --init --recursive
./configure --prefix=/opt/riscv --with-arch=rv32g --with-abi=ilp32d
make linux