Skip to content

Instantly share code, notes, and snippets.

View kernelhcy's full-sized avatar
🚁
living~

Congyu Huang kernelhcy

🚁
living~
View GitHub Profile
#!/bin/bash
URL="https://www.zq12369.com/"
DATA=`curl --noproxy "*" -s $URL`
FORECAST_DATA=`echo $DATA | pup 'div[class="forecast"] json{}'`
AQI_DATA=`echo $DATA | pup 'div[class="aqidetail"] json{}' | jq '.[0].children'`
curl -s 'https://www.zq12369.com/' | pup 'div[class="aqibg aqibanner1"]' | pup 'div[class="aqi"] json{}' | jq -cMr '.[0].text'
#!/bin/bash
# <bitbar.title>Homebrew Updates</bitbar.title>
# <bitbar.author>killercup</bitbar.author>
# <bitbar.author.github>killercup</bitbar.author.github>
# <bitbar.desc>List available updates from Homebrew (OS X)</bitbar.desc>
exit_with_error() {
echo "err | color=red";
exit 1;
}
@kernelhcy
kernelhcy / weather.20m.sh
Last active March 10, 2020 06:00
bitbar
#!/bin/bash
JQ_BIN=/usr/local/bin/jq
#MENUFONT="size=13 font=UbuntuMono-Bold"
MENUFONT="size=15"
COLORS=("#0ed812" "#ffde33" "#ff9933" "#cc0033" "#660099" "#7e0023")
CURRENT_WEA_URL="https://tianqiapi.com/api/?version=v6&appid=76961778&appsecret=K1Evb4rc"
DATA=`curl --noproxy "*" -s "${CURRENT_WEA_URL}"`
@kernelhcy
kernelhcy / bootup.sh
Created October 12, 2019 13:51
raspberry bootup script
#!/bin/bash
echo -e "\033[34m[umount] /home/hcy/mycloud/data... \033[0m"
umount /home/hcy/mycloud/data > /dev/null 2>&1
echo -e "\033[34m[umount] /home/hcy/mycloud/public... \033[0m"
umount /home/hcy/mycloud/public > /dev/null 2>&1
echo -e "\033[34m[umount] /home/hcy/mycloud/tddownloads... \033[0m"
umount /home/hcy/mycloud/tddownloads > /dev/null 2>&1
echo -e "\033[34m[mount] /nfs/Data to /home/hcy/mycloud/data... \033[0m"
@kernelhcy
kernelhcy / weather.sh
Last active March 11, 2020 14:14
get current location's current weather
#! /bin/bash
#set -x
VERSION="1.6.1"
JQ_BIN=jq
LAST_TIME_FILE='/tmp/wea_last_time'
LAST_WEATHER='/tmp/wea_last_weather'
@kernelhcy
kernelhcy / new_gist_file.vbs
Created November 7, 2014 15:45
获取Windows系统当前序列号
Dim s
s = InputBox("当前Windows系统序列号为:", "Windows序列号", GetWindowsSN)
WScript.Quit
'取得当前Windows序列号函数
Function GetWindowsSN()
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@kernelhcy
kernelhcy / SSLBuffer.cpp
Created April 17, 2014 02:39 — forked from roxlu/SSLBuffer.cpp
libuv+libopenssl
#include "SSLBuffer.h"
SSLBuffer::SSLBuffer()
:ssl(NULL)
,read_bio(NULL)
,write_bio(NULL)
,write_to_socket_callback(NULL)
,write_to_socket_callback_data(NULL)
,read_decrypted_callback(NULL)
,read_decrypted_callback_data(NULL)
class Linux_0_01
{
int restart_syscall(); //0
int exit(); //1
int fork(); //2
int read(); //3
int write(); //4
int open(); //5
int close(); //6
int waitpid(); //7
@kernelhcy
kernelhcy / btree_cpp.h
Created October 4, 2013 14:11
STX B+ Tree实现
/**
* \file include/stx/btree.h
* Contains the main B+ tree implementation template class btree.
*/
/*
* STX B+ Tree Template Classes v0.9
* Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* Boost Software License - Version 1.0 - August 17th, 2003