Skip to content

Instantly share code, notes, and snippets.

View cyyself's full-sized avatar

Yangyu Chen cyyself

View GitHub Profile
@cyyself
cyyself / ipv6passthrough.sh
Last active September 3, 2018 14:38
IPv6 Pass Through
#!/bin/sh
ebtables -t broute -A BROUTING -p ! ipv6 -j DROP
brctl addbr ipv6br
ifconfig ipv6br up
brctl addif ipv6br eth0
brctl addif ipv6br wlan0
@cyyself
cyyself / hostapd(rpi 3b+).conf
Last active September 3, 2018 14:43
Raspberry Pi 3B+ 11ac Hotspot
interface=wlan0
driver=nl80211
hw_mode=a
ieee80211n=1
ieee80211ac=1
ieee80211d=1
ieee80211h=1
require_ht=1
require_vht=1
@cyyself
cyyself / curl.php
Last active September 19, 2018 06:19
<?php
$curl_cmd = trim(fgets(STDIN));
$filename = md5($curl_cmd) . '.html';
while (1) {
$ret = shell_exec($curl_cmd.' -w %{http_code} -o '. $filename .' -i');
if ($ret != '503') break;
}
echo 'Saved to ' . $filename . "\n";
?>
@cyyself
cyyself / 合式判断.cpp
Created February 27, 2019 15:15
离散数学老师的作业,欢迎Hack
/*
'A'-'Z'表示命题
!表示非
&表示合取
|表示析取
A@B表示如果A,那么B
A#B表示双条件
()表示优先级
*/
#include <bits/stdc++.h>
import os
import os.path
import win32com
import win32com.client
import time
def ppt2pptx(file):
powerpoint = win32com.client.Dispatch('PowerPoint.Application')
win32com.client.gencache.EnsureDispatch('PowerPoint.Application')
powerpoint.Visible = 1
ppt = powerpoint.Presentations.Open(file)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
@cyyself
cyyself / 2021-red-envelope.v
Last active February 11, 2021 15:56
我的2021年新年红包的支付宝口令就藏在这个.v文件中,你能找到吗?
module some_server(
input clk,
input rst,
input ethernet_frame_bit_in,//high bit first
output correct
);
reg [9:0] current_stat;
assign correct = (current_stat == 10'd896);
module axi_perf(
input clock,
input reset,
input mem_axi4_0_awready,
output mem_axi4_0_awvalid,
output [3:0] mem_axi4_0_awid,
output [30:0] mem_axi4_0_awaddr,
output [7:0] mem_axi4_0_awlen,
output [2:0] mem_axi4_0_awsize,
output [1:0] mem_axi4_0_awburst,
/*
Hello, I'm using d1-wip kernel from https://github.com/smaeul/linux/commits/riscv/d1-wip.
My rootfs is archriscv from https://mirrors.wsyu.edu.cn/archriscv/images/archriscv-20210601.tar.zst.
I found some programs running on this kernel will get SEGV, such as curl.
I delve into this problem and found the root cause is about pthread. It just trap at "amoswap.w.aq a5,a5,(s1)". And the value of register s1 is an address on the stack.
Here is a simple program with pthread. using gcc -lpthread to compile and run on D1-board with work in progress kernel is fine.
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
int main() {
int fd = shm_open("test-shm", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd == -1) {
printf("Unable to open shm\n");