Skip to content

Instantly share code, notes, and snippets.

View ysc3839's full-sized avatar

Richard Yu ysc3839

View GitHub Profile
@ysc3839
ysc3839 / stroke.c
Last active July 21, 2016 04:24
Image Stroke Algorithm
#include <stdint.h>
void stroke(void *srcBmp, void *dstBmp, size_t width, size_t height)
{
for (size_t x = 0; x < width; x++)
{
for (size_t y = 0; y < height; y++)
{
uint32_t *src = (uint32_t *)srcBmp + y * width;
uint32_t currPixel = src[x];
@ysc3839
ysc3839 / shBrushSquirrel.js
Created July 30, 2016 13:14
Squirrel hightlight js
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
*
* @version
* 2.0.320 (May 03 2009)
*
@ysc3839
ysc3839 / lxlaunch.cpp
Created January 15, 2017 14:50
lxlaunch.cpp
#include <initguid.h>
#include <Windows.h>
#include <comutil.h>
#include "..\inc\nt.h"
#include "..\inc\lxssmanager.h"
#include "..\inc\adss.h"
#ifndef DISABLE_NEWLINE_AUTO_RETURN
#define DISABLE_NEWLINE_AUTO_RETURN 0x08
#endif
@ysc3839
ysc3839 / S99znc
Last active January 26, 2017 00:41
znc init
#!/bin/sh
# Give a r\w permissions for "nobody" user
find /opt/share/znc/ -type f | xargs chmod 666
find /opt/share/znc/ -type d | xargs chmod 777
# Add droproot to znc.conf
CONF=/opt/share/znc/configs/znc.conf
grep -Fq "LoadModule = droproot" $CONF || echo "LoadModule = droproot nobody nogroup" >> $CONF
@ysc3839
ysc3839 / translatebot.py
Created February 5, 2017 09:50
Telegram translate bot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=I0011,C0111,C0103
from __future__ import print_function
import threading
import telepot
from telepot.namedtuple import InlineQueryResultArticle, InputTextMessageContent
from goslate import Goslate
@ysc3839
ysc3839 / msg2po.py
Last active April 9, 2017 06:49
PO Msg Converter
import sys
from os import path
import re
import polib
def msg2po(msgfile, pofile):
with open(msgfile, 'rb') as f:
messages = f.read()
po = polib.POFile()
#!/bin/sh
cookie="your cookie"
servers="cccat.club cccat.pw cccat.pro"
set -- $servers
while [ -n "$1" ]; do
logger -t CCCATSIGN Checking in $1.
response=$(wget -q -O - --header "Cookie: $cookie" https://$1/user/_checkin.php 2>&1)
@ysc3839
ysc3839 / cloudxns.sh
Last active April 30, 2017 08:00
cloudxns.sh
#!/bin/sh
[ "$1" = "" ] && exit 1
API_KEY=""
SECRET_KEY=""
DOMAIN=""
HOST=""
IP="$1"
import _vcmp
from _vcmp import functions
import irc.bot
class TestBot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.channel = channel
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Add-Type -TypeDefinition @"
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace System {
public class IconExtractor {
public static Icon Extract(string file, int number, bool largeIcon) {
IntPtr large;