Skip to content

Instantly share code, notes, and snippets.

View shimarin's full-sized avatar

Tomoatsu Shimada shimarin

View GitHub Profile
@shimarin
shimarin / horiz3.lua
Last active June 6, 2020 12:28
Custom layout for Awesome WM with triple vertical screen
local math = math
local horiz3 = {
name = "horiz3"
}
function split_horizontal(g)
g.width = g.width / 2
return {
x = g.x + g.width,
@shimarin
shimarin / ignore-wifi-get-interface-errors.patch
Created January 29, 2020 04:22
A patch to force systemd deal with KUSO wifi dongle like R8188EU
diff --git a/src/network/networkd-wifi.c b/src/network/networkd-wifi.c
index 14a8687458..12cf4eda23 100644
--- a/src/network/networkd-wifi.c
+++ b/src/network/networkd-wifi.c
@@ -35,7 +35,7 @@ int wifi_get_info(Link *link) {
_cleanup_free_ char *ssid = NULL;
r = wifi_get_interface(link->manager->genl, link->ifindex, &link->wlan_iftype, &ssid);
if (r < 0)
- return r;
+ return 0;
#!/usr/bin/electron
module.paths.push("/usr/lib64/node_modules");
const path = require("path");
const {app, globalShortcut, BrowserWindow} = require('electron');
const contextMenu = require('electron-context-menu');
var mainWindow = null;
contextMenu();
#!/bin/bash
# addn-hosts=/var/lib/misc/dhcp-hosts
# dhcp-script=/etc/dnsmasq.sh
ADDN_HOSTS=/var/lib/misc/dhcp-hosts
case "$1" in
"add" ) echo "$3" `echo $2 | sed 's/://g'`.dhcp > $ADDN_HOSTS/$3 ;;
"del" ) rm -f $ADDN_HOSTS/$3 ;;
"old" ) exit ;;
esac
echo `date` $1 $2 $3 >> /var/log/dnsmasq.log
#!/usr/bin/python2
import os,sys,argparse
import paho.mqtt.client as mqtt
import mdns_resolver
dirname = os.path.dirname(os.path.abspath(__file__))
nodename = "unknown-node"
force_check_topic = "gearchange-force-check"
import machine,network
lan = network.LAN(id = None, mdc = machine.Pin(23), mdio = machine.Pin(18), power = machine.Pin(2), phy_addr = 1, phy_type = network.PHY_LAN8720)
lan.active(1)
lan.ifconfig()
@shimarin
shimarin / wifi-eth-bridge.c
Last active May 2, 2019 00:50
wifi eth bridge idea
#include <esp_private/wifi.h>
#include <netif/wlanif.h>
static esp_err_t tcpip_adapter_sta_input(void *buffer, uint16_t len, void *eb)
{
if (destination_mac_address_belongs_to_eth) {
esp_eth_tx(buffer, len);
esp_wifi_internal_free_rx_buffer(eb);
return ESP_OK;
}
@shimarin
shimarin / micropython_esp32_native_memory.patch
Created March 21, 2019 13:38
native_memory module for MicroPython ESP32
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index 36ee4b3b0..3af707a13 100644
--- a/ports/esp32/Makefile
+++ b/ports/esp32/Makefile
@@ -178,6 +178,7 @@ SRC_C = \
machine_dac.c \
machine_pwm.c \
machine_uart.c \
+ native_memory.c \
modmachine.c \
from machine import Pin,SPI
from ssd1306 import SSD1306_SPI
oled = SSD1306_SPI(128, 64, SPI(2,sck=Pin(18),mosi=Pin(23), miso=Pin(19)),dc=Pin(2),res=Pin(4),cs=Pin(5))
oled.text('Hello, World!', 0, 0)
oled.show()