Skip to content

Instantly share code, notes, and snippets.

View Jimmy-Xu's full-sized avatar

Jimmy Xu Jimmy-Xu

  • Ant Group
  • Beijing, China
View GitHub Profile
@Jimmy-Xu
Jimmy-Xu / build-python-2.7.9.sh
Created December 14, 2015 16:45
upgrade Python 2.7.6 -> 2.7.9 on Ubuntu 14.04
#!/bin/sh
#
# Installs Python 2.7.9 on Ubuntu 14.04 to include security updates
# Run this script with superuser privileges.
#
BASEDEPS="build-essential python-pip"
BUILDDEPS="libbz2-dev \
libc6-dev \
libgdbm-dev \
@jpillora
jpillora / unix-to-tcp.go
Last active October 14, 2021 14:06
Forward unix socket to tcp socket
package main
import (
"io"
"log"
"net"
"os"
)
const (
@gsong
gsong / gist:6321633
Last active February 4, 2022 12:06
Bash script to generate SSL csr/key/crt
#!/bin/bash
# Usage:
#
# ssl_setup [--self] <name> <csr_config>
#
# This script is used to generate key and CSR for use HTTPS in Nginx.
#
# --self Generate self-signed certificate in addition to key and CSR.
# name Output files will be named as <name>.key and <name>.csr.
@henryyan
henryyan / gist:2183712
Created March 24, 2012 14:43
Activiti:获取当前Task在流程图的坐标
/**
* 读取资源
*
* @return
*/
public String loadResource() {
try {
InputStream resourceAsStream = null;
if (StringUtils.isNotBlank(processInstanceId)) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

这是一个用树莓派做Bitcoin Unlimited全节点的示例。对于没用使用过全节点钱包,也不熟悉命令行操作的朋友,建议先看这篇教程,尝试在PC或Mac上安装和同步区块链,这样更容易理解这个示例。

为什么要用树莓派做全节点?

树莓派体积小,耗电小,无噪音,非常适合24小时工作。比特币节点对系统性能要求不高,专门24小时开着一台电脑,耗电和噪音都是很不环保的,且性能有极大的浪费。树莓派耗电仅和手机充电器相当,也没有风扇。你甚至不需要为树莓派安排地方,随便塞在哪里就行了,操作可以在其他的电脑上,通过SSH进行。用树莓派搭建节点,也可以学习到基本的Linux系统操作知识。搭建节点之后,树莓派上可以继续搭建其他服务,比如做个人云盘,BT挂机下载等等。

准备工作

需要准备如下几样东西。此例使用树莓派3B,这版有1GB内存,也有wifi,性能是目前树莓派家族最好的。512MB内存的树莓派2或者zero也是可以用的。清单如下:

  • 树莓派 3B(配盒子,电源)
  • 16GB的SD卡Class 10 microSDHC
@sheikhwaqas
sheikhwaqas / setup-mysql.sh
Last active September 6, 2023 15:59
Install MySQL Server on Ubuntu (Non-Interactive Installation)
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
# Set the Server Timezone to CST
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Enable Ubuntu Firewall and allow SSH & MySQL Ports
ufw enable
ufw allow 22
@charlax
charlax / gist:38ecd925a8bcb8cadcf5
Created April 3, 2015 17:50
Fix Unable to find 'openssl/opensslconf.h'
SWIG/_m2crypto.i:30: Error: Unable to find 'openssl/opensslv.h'
SWIG/_m2crypto.i:33: Error: Unable to find 'openssl/safestack.h'
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
@timnew
timnew / Rename.ps1
Last active March 15, 2024 13:49
Script to Rename Computer without Reboot
$ComputerName = "New Name"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname"
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\Computername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\ActiveComputername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -name "AltDefaultDomainName" -value $ComputerName
@r0l1
r0l1 / copy.go
Last active March 23, 2024 12:38
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@aserhat
aserhat / 0 - setup
Last active March 23, 2024 14:51
QEMU and HVF
# Summary
A few notes I took to see if I could use MacOS as Hypevirsor in a similar fashion to Linux
I wanted to see how few addons were needed instead of using Parallels, Virtual Box, VM Fsion etc.
The idea is to use QEMU, Hypervisor Framework (https://developer.apple.com/documentation/hypervisor) and some custom host networking.
# Installations
brew install qemu (For controlling Hypervisor Framework)
brew install cdrtools (For making cloud init iso's)
http://tuntaposx.sourceforge.net/download.xhtml (For customer tap based networking)