Skip to content

Instantly share code, notes, and snippets.

View 1a57danc3's full-sized avatar
⛱️
On vacation

Howard 1a57danc3

⛱️
On vacation
View GitHub Profile
var cv = document.getElementById('cv');
var c = cv.getContext('2d');
var txtDiv = document.getElementById('txt');
var fileBtn = document.getElementById("up-button");
var img = new Image();
img.src = 'a.jpg';
img.onload = init; // 图片加载完开始转换
fileBtn.onchange = getImg;
// 根据灰度生成相应字符
# /etc/nginx/sites-available/fanfou.shellex.info
# 这儿假设的域名是 fanfou.shellex.info
# 请替换为实际的域名
server {
resolver 8.8.8.8;
listen 443;
server_name fanfou.shellex.info;
ssl on;
@1a57danc3
1a57danc3 / rocflag
Last active August 31, 2018 06:42
R.O.C flag in cpp+c#
in CPP------------------
unsigned int CPixelBlueSkyWhiteSun::CalculatePixel(unsigned int x, unsigned int y)
{ unsigned int red = 0xffff0000;
unsigned int white = 0xffffffff;
unsigned int blue = 0xff0000ff;
float w = m_width*0.5f;
float h = m_height*0.5f;
if ((float)x > w || (float)y > h)
{
return red;
@1a57danc3
1a57danc3 / FBI WARNING SSH NOTIFICATION.SH
Last active January 5, 2021 01:31
FBI WARNING SSH NOTIFICATION
#!/bin/bash
# Find out current screen width and hight
_COLUMNS=$(tput cols)
# Set default message if ( input not provided
_MESSAGE=" FBI Warining "
# Calculate x and y coordinates so that we can display $MESSAGE
# centered in the screen
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
# Alright display message stored in $_MESSAGE
@1a57danc3
1a57danc3 / commandline.txt
Last active November 8, 2015 10:51
graphics settings solution for gta iv / eflc
-NORESTRICTIONS
@1a57danc3
1a57danc3 / install_Dota2.md
Last active December 11, 2016 11:55
Install Dota2 (international) Edition
  1. Go to Steam Licenses List and login your account.

  2. Use browser javascript console (such as F12 on Chrome/Firefox)

  3. Execute javascript code, after console display Object {readyState: 1}

     jQuery.ajax(
     {
             type:'POST',
    

dataType:'text',

@1a57danc3
1a57danc3 / ntfs_mount.py
Created December 16, 2015 15:49 — forked from selfboot/ntfs_mount.py
mac os x:自动挂载ntfs硬盘为读写权限。 只要ntfs硬盘连接到电脑即可使用 ./ntfs_mount_auto.py 挂载ntfs磁盘为可读写,ntfs_unmount.py 为卸载磁盘。 ntfs_mount.py 是较早的版本,只有电脑先识别除硬盘,在/Volumes 可读到硬盘内容时才可以使用此脚本挂载为可读写。 建议使用./ntfs_mount_auto.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import re
ntfs_pattern = re.compile(r'File System Personality: NTFS')
ntfs_device_node = re.compile(r'.*Device Node:.*')
device_dict = {}
[Proxy]
WIFI = direct, interface=en2
VPN = direct, interface=utun0
[Rule]
DOMAIN-SUFFIX,yach.me,WIFI
FINAL,VPN
@1a57danc3
1a57danc3 / readme.txt
Created March 18, 2016 08:52 — forked from fqrouter/readme.txt
shadowsocks 公共代理的必要设置
good, 你已经有了一个自己的shadowsocks代理了,现在想要把这个代理公布出去给所有人分享。
但是没有两个小时,代理就没法使用了,为什么?因为你需要额外注意以下事项(以下步骤需要比较高的linux技能)
本文只关注于确保shadowsocks服务还“活着”,如果你希望让其跑得更快,请参考
https://github.com/clowwindy/shadowsocks/wiki/Optimizing-Shadowsocks
1、 shadowsocks的timeout设置
超时时间越长,连接被保持得也就越长,导致并发的tcp的连接数也就越多。对于公共代理,这个值应该调整得小一些。推荐60秒。
2、 检查操作系统的各种限制
对于openvz的vps,特别需要检查一下
@1a57danc3
1a57danc3 / fix-homebrew-npm.md
Created March 24, 2016 08:13 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.