Skip to content

Instantly share code, notes, and snippets.

View aguegu's full-sized avatar
🎯
Focusing

Weihong Guan aguegu

🎯
Focusing
View GitHub Profile
@aguegu
aguegu / wg0.conf
Last active October 24, 2022 08:35
PublicKey = wKjSrciKsI5/Cgw/7K+IQmizfSllc1fZ1lX9Cu8ByDw=
AllowedIPs = 10.0.0.6/32
PublicKey = 9kbLtWCwINyQgKX3kjSvHA4ez1nji0IjDNuAkTRnlAA=
AllowedIPs = 10.0.0.9/32
# Basic Strongswan ikev2 server setup
* paltform: atlantic.net ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
```
apt-get install strongswan
apt-get install iptables iptables-persistent
```
@aguegu
aguegu / feeder.js
Created December 13, 2018 08:21
csv.tar.gz generator
/* eslint-env mocha */
/* eslint no-console: 'off' */
import chai from 'chai';
import chaiHttp from 'chai-http';
import 'chai/register-should';
import { createObjectCsvWriter } from 'csv-writer';
import config from 'config';
import _ from 'lodash';
import moment from 'moment';
@aguegu
aguegu / ss2qrcode.py
Created March 18, 2017 14:51
Shadowsocks QRCode generation
import pyqrcode
import base64
url = 'bf-cfb-auth:test@192.168.100.1:8888'
print pyqrcode.create('ss://' + base64.b64encode(url)).terminal()
@aguegu
aguegu / README.md
Created September 27, 2016 15:19 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

import time
from threading import *
import wx
EVENT_TYPE_ID = wx.NewId()
class WorkerThread(Thread):
def __init__(self, notify_window):
Thread.__init__(self)
self._notify_window = notify_window
@aguegu
aguegu / oracle.sh
Created November 11, 2013 02:04
/etc/init.d/oracle, init script for oracle, based on http://www.server-world.info/en/note?os=CentOS_6&p=oracle11g&f=5
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
@aguegu
aguegu / centos.sh
Created November 11, 2013 00:18
startup my headless centos virtualbox.
#!/bin/bash
nohup VBoxHeadless -s centOS
@aguegu
aguegu / ds18b20.sh
Created November 5, 2013 16:06
get temperature from ds18b20 on RPi in Bash
#!/bin/bash
modprobe w1-gpio
modprobe w1-therm
if [ -d /sys/bus/w1/devices ]; then
id=$(ls /sys/bus/w1/devices/ | head -n 1);
temperature=$(tail -n 1 /sys/bus/w1/devices/$id/driver/$id/w1_slave | grep -o "[-0-9]*$")
echo "scale=3;" $temperature "/ 1000.0" | bc
//============================================================================
// Name : socket_demo.cpp
// Author : aGuegu
// Version :
// Copyright : GPL v2.0
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <stdio.h>
#include <stdlib.h>