Skip to content

Instantly share code, notes, and snippets.

@loggerhead
loggerhead / a.json
Last active October 25, 2023 13:40
diff-example
[
{
"recharge": 900000
},
{
"available": 0
}
]
@loggerhead
loggerhead / main.cpp
Last active October 11, 2020 05:25
producer-consumer
#include <atomic>
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <queue>
#include <thread>
using namespace std;
const int nproducer = 4;
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <unistd.h>
#include "co_routine.h"
using namespace std;
int co_accept(int fd, struct sockaddr *addr, socklen_t *len);
@loggerhead
loggerhead / .gitignore
Last active June 22, 2018 12:48
Erlang快速入门
*.beam
/*
* 1. git clone https://github.com/tmk/tmk_keyboard.git
* 2. cp keymap_loggerhead.* tmk_keyboard/keyboard/hhkb/
* 3. make KEYMAP=loggerhead
* 4. run `dfu-programmer` commands with argument of "hhkb.hex", e.g:
*
* sudo dfu-programmer atmega32u4 erase
* dfu-programmer atmega32u4 flash hhkb.hex
* dfu-programmer atmega32u4 reset
*/
@loggerhead
loggerhead / client.c
Last active October 30, 2017 09:20
web server example based on libuv
#include <stdio.h>
#include <assert.h>
#include <uv.h>
void after_write(uv_write_t *req, int status)
{
printf("after_write\n");
assert(!status);
}
@loggerhead
loggerhead / bwg-wacher.py
Created October 16, 2017 07:11
Notify you if there is update of stocks in https://bandwagonhost.com/cart.php
# -*- coding: utf-8 -*-
import os
import time
import requests
from datetime import datetime
from pyquery import PyQuery as pq
URL = 'http://bwh1.net/cart.php'
GAP = 3600

Keybase proof

I hereby claim:

  • I am loggerhead on github.
  • I am loggerhead (https://keybase.io/loggerhead) on keybase.
  • I have a public key ASCW0gT5PoNbkHrVE-vW5u6exOJTV0m76YVr93ERB60H5go

To claim this, I am signing this object:

@loggerhead
loggerhead / ipc.c
Created April 14, 2017 08:23
Practices of IPC
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/un.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/stat.h>
@loggerhead
loggerhead / fuck_gfw.sh
Last active August 3, 2016 15:36
Several commands start VPN and Shadowsocks
#!/bin/bash
if [ -z "$SS_PASSWORD" ]; then
SS_PASSWORD="SET_YOUR_PASSWORD_HERE"
fi
if [ -z "$SS_METHOD" ]; then
SS_METHOD="aes-256-cfb"
fi
if [ -z "$SS_SERVER_PORT" ]; then
SS_SERVER_PORT=995
fi