Skip to content

Instantly share code, notes, and snippets.

View grasses's full-sized avatar
🎯
Focusing

grasses

🎯
Focusing
View GitHub Profile
@ashokpant
ashokpant / cuda_9.0_cudnn_7.0.sh
Last active November 16, 2023 21:42
Install CUDA Toolkit v9.0 and cuDNN v7.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v9.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb)
CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb"
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda-9-0
@YihaoPeng
YihaoPeng / Stratum挖矿协议.md
Last active July 26, 2023 14:07
Stratum挖矿协议

Stratum挖矿协议: 该协议是由SlushPool制定的,请参阅其官方文档:https://slushpool.com/help/manual/stratum-protocol

以下所有报文均使用\n做为行结束符。


矿机订阅:

{"id": 1, "method": "mining.subscribe", "params": []}
#!/bin/bash
# save as /root/del_user.sh
USERNAME=$1
if [[ -z "$USERNAME" ]]; then
echo "Please give me a username"
exit 1
fi
echo "This script will"
@grasses
grasses / php.fpm
Last active December 11, 2015 03:33
php-fpm controller for mac, please confirm php-fpm is in your $PATH environment.
#!/bin/sh
param=$1
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script."
exit 1
fi
start()
@grasses
grasses / nfs-server-for-centos
Last active November 11, 2015 02:56
An nfs install script for centos 6
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install nfs"
exit 1
fi
@grasses
grasses / AES-256
Created October 6, 2015 11:45
AES-256 for php, with php module mcrypt, for more see: http://php.net/manual/en/function.mcrypt-encrypt.php
<?php
class MCrypt {
private $hex_iv = '00000000000000000000000000000000'; // converted JAVA byte code in to HEX and placed it here
private $key = 'U1MjU1M0FDOUZ.Qz'; //Same as in JAVA
function __construct() {
$this->key = hash('sha256', $this->key, true);
}
function encrypt($str) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Queue import Queue
import threading, random, time
__author__ = 'homeway'
__version__ = '2015.10.01'
class producer(threading.Thread):
  1. 开启ipv4转发
vi /etc/sysctl.conf
# 将net.ipv4.ip_forward=0更改为net.ipv4.ip_forward=1
sysctl -p
  1. 安装dnsmasq 和pdnsd解决dns污染

DNS的解析方案为 resolve.conf ==> dnsmasq ==> pdnsd

@cdodd
cdodd / install-squid.sh
Last active June 17, 2022 15:08
Install a basic squid proxy with authentication on Centos 6 x64. Just modify the variables at the top and run the script on a clean system.
#!/bin/sh
PROXY_USER=user
PROXY_PASS=password
PROXY_PORT=3128
# Clear the repository index caches
yum clean all
# Update the operating system
@scutdavy
scutdavy / shell.c
Created December 5, 2013 04:35
unix shell简单实现,支持参数,管道,重定向
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <errno.h>
#define TRUE 1