Skip to content

Instantly share code, notes, and snippets.

@hcccc
hcccc / danmu.js
Created June 3, 2017 05:20
Interval example
(function () {
const messageList = [
'求手机!', '非常棒', '我要看大长腿', '小电视暗中观察', '为什么我还没中',
'我要当欧皇', '中了直播开机哦', '求奇迹出现', '呜呜呜不中啊']
const roomId = window.location.href.match(/\.com\/(\d+)/)[1];
const bilibiliSendDanmuPost = 'http://live.bilibili.com/msg/send';
setInterval(function () {
var message = messageList[parseInt(Math.random() * (messageList.length - 1))] || '小米很棒!!';
console.log('准备发送: ' + message);
@hcccc
hcccc / bilibili_danmu.js
Last active June 3, 2017 04:08
bilibili_danmu.js
(function () {
const messageList = [
'这是在哪里?', '非常棒', '抽奖小哥呢?', '小电视暗中观察', '为什么我还没中',
'我要当欧皇', '中了直播开机哦', '求奇迹出现', '呜呜呜不中啊']
const roomId = window.location.href.match(/\.com\/(\d+)/)[1];
const bilibiliSendDanmuPost = 'http://live.bilibili.com/msg/send';
const secInHr = 1000 * 60 * 60;
const sendTiming = 1000 * 60 * 50;
var count = 0;
@hcccc
hcccc / tmux-cheatsheet.markdown
Created December 21, 2015 08:00 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<!-- BEGIN table -->
<table border="1">
<tr>
<th width="30">番号</th>
<th width="100"><a href="search.php?sort=name{param}{name_order}">プレイヤー名</a><br>(<a
href="search.php?sort=chara{param}{chara_order}">キャラクター</a>)
</th>
<th width="150">好きなアニメ</a></th>
<th width="270">コメント</th>
<th width="50">投票</th>
@hcccc
hcccc / LongestSubstring.c
Created February 11, 2015 08:30
Longest Substring Without Repeating Characters
//Longest substring without repeating chars
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int lengthOfLongestSubstring(char *s) {
int maxlen = 0;
int curlen = 0;
int len = strlen(s);
int map[256];
@hcccc
hcccc / gist:7598280
Created November 22, 2013 11:13
Web GL Random sample
<html>
<head>
<title>Learning WebGL &mdash; lesson 1</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="glMatrix-0.9.5.min.js"></script>
<script id="shader-fs" type="x-shader/x-fragment">
precision mediump float;
@hcccc
hcccc / decode_ip.c
Created September 5, 2013 19:52
Simple helper in C decodes IP address to binary format
#include <stdio.h>
#include <string.h>
int main(){
long int remainder, quotient;
int binaryNumber[100], i = 1, j = 0, k = 0, l = 0;
int remaining_zero = 0;
int ipaddr[4];
printf("Enter IP: ");
@hcccc
hcccc / hex_dec.c
Last active December 11, 2015 12:58
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BITMASK(n) (1 << (n))
void divide_and_print(int x){
printf("Dec: %d\n", x);
printf("Hex: 0x%X\n", x);