Skip to content

Instantly share code, notes, and snippets.

@tevino
tevino / lircd.conf
Created January 10, 2013 09:22
lircd.conf for supplied remote control of Mele A1000/A2000/A100 /etc/lirc/lircd.conf
# generated by devinput.sh
begin remote
name devinput
bits 16
eps 30
aeps 100
pre_data_bits 16
pre_data 0x0001
post_data_bits 32
post_data 0x00000001
@tevino
tevino / n2n_v2_osx_fix.diff
Created March 27, 2014 02:10
This fix an error about the function `tun_close` in n2n_v2(r7394 tested) when compiling on OS X
If you see the error message below, you may need this patch:
Undefined symbols for architecture x86_64:
"_tun_close", referenced from:
_tuntap_open in n2n.a(tuntap_osx.o)
ld: symbol(s) not found for architecture x86_64
# How to use
If you got the source code from official repository, like me:
svn co https://svn.ntop.org/svn/ntop/trunk/n2n
@tevino
tevino / fix_virtualenv
Last active March 24, 2024 09:41
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
BAD_ENV_PATHS="/usr/local"
echo "Ensure the root of the broken virtualenv:"
echo " $ENV_PATH"
@tevino
tevino / vpn_auto_reconnect
Created June 26, 2015 11:17
A script for automatically reconnecting VPN on OS X after connection dropped
#!/usr/bin/env python
import re
from time import sleep
from subprocess import check_output as run
last_print = None
def printf(s, no_repeat=False):
global last_print
@tevino
tevino / cVimrc
Last active November 10, 2015 14:12
cVimrc
" blacklists prefixed by '@' act as a whitelist
let blacklists = ["https://mail.google.com/*", "*://mail.google.com/*", "*://inbox.google.com/*", "@https://mail.google.com/mail/*"]
@tevino
tevino / epoll.go
Last active January 20, 2024 22:50
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@tevino
tevino / copy.go
Created November 30, 2015 02:29
test of io.Copy
package main
import (
"fmt"
"io"
"net"
)
var addrSrv, _ = net.ResolveTCPAddr("tcp", "localhost:2000")
var addrClt, _ = net.ResolveTCPAddr("tcp", "localhost:2001")
@tevino
tevino / hiwifi-sshd.md
Last active June 16, 2021 04:17
Enable ssh server on hiwifi

Get login token

  1. Login into http://192.168.99.1
  2. Copy the token in the url (stok=TOKEN)

Open the secret page

Fill the token in this url, then open it:

http://192.168.99.1/cgi-bin/luci/;stok={LOGIN TOKEN HERE}/admin/system/startup

Add the following into text box at the bottom before exit 0:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import random
import logging
from collections import Counter, defaultdict
from redis import StrictRedis
import gevent
from gevent.pool import Pool
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
int main(){
int fds[2];
int ret;
ssize_t size;