Skip to content

Instantly share code, notes, and snippets.

View lyhcode's full-sized avatar

Kyle Lin lyhcode

View GitHub Profile

Discord

(Unofficial) Discord server rules suggestions list

Author's Note

I'll start off with letting you know this is a fork from someone else. However, for some bizarre reason, this is the one everyone finds, so I better get round to updating this. Credit to Cristiano#2233 for the original idea.

Also, I've had a lot of people saying the rules are to strict. If you pick all the rules here, you're right, it would be very strict. However the rules below are guidelines! They are there for you to pick the ones you desire, you can ignore ones you don't want. Hopefully they might help with rules you wouldn't have thought of otherwise.

var system = require('system');
var url = system.args[1];
var filename = system.args[2];
var page = new WebPage();
page.viewportSize = {
width: 1920,
height: 1080
};
var system = require('system');
var url = system.args[1];
var filename = system.args[2];
var page = new WebPage();
page.open(url, function (status) {
page.render(filename);
console.log(filename)
phantom.exit();
});
@lyhcode
lyhcode / backup.ps1
Created December 20, 2017 12:47
PowerShell script for sql server database backup with timestamp file name.
$dt = Get-Date -Format yyyyMMddHHmmss
$dbname = 'dfi'
$username = 'DFINewWebsiteSI'
#read-host -assecurestring | convertfrom-securestring | out-file sqlsecure.txt
$password = Get-Content sqlsecure.txt
$secpasswd = $password | ConvertTo-SecureString
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $username,$secpasswd
$bakfile = "C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\dfi_$($dt).bak"
Write-Output "backup database to disk file = $bakfile"
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11);
const int segp[] = {3, 4, 5, 2};
const int strp[] = {6, 7, 8, 9};
bool ps[] = {0, 0, 0};
bool str[] = {0, 0, 0, 0};
bool touched = false;
14:14:27.279 [QUIET] [system.out] [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
14:14:27.279 [DEBUG] [TestEventLogger] Exception Details:
14:14:27.279 [DEBUG] [TestEventLogger] Location:
14:14:27.279 [DEBUG] [TestEventLogger] geb/navigator/SearchContextBasedBasicLocator.<init>(Lorg/openqa/selenium/SearchContext;Lgeb/navigator/factory/NavigatorFactory;)V @91: invokespecial
14:14:27.279 [DEBUG] [TestEventLogger] Reason:
14:14:27.279 [DEBUG] [TestEventLogger] Error exists in the bytecode
14:14:27.279 [DEBUG] [TestEventLogger] Bytecode:
14:14:27.279 [DEBUG] [TestEventLogger] 0000000: b800 214e 05bd 0004 5903 04bd 0004 5903
14:14:27.279 [DEBUG] [TestEventLogger] 0000010: 2b53 b800 2753 5904 2c53 5910 ff12 02b8
14:14:27.279 [DEBUG] [TestEventLogger] 0000020: 002b 2a5f ab00 0000 0000 005e 0000 0002
@lyhcode
lyhcode / pdftrim
Created March 8, 2015 07:21
Remove text layer from PDF using Apache PDFBox in a Groovy script
#!/usr/bin/env groovy
@Grab('org.apache.pdfbox:pdfbox:1.8.8')
import org.apache.pdfbox.cos.COSArray
import org.apache.pdfbox.cos.COSString
import org.apache.pdfbox.pdfparser.PDFStreamParser
import org.apache.pdfbox.pdfwriter.ContentStreamWriter
import org.apache.pdfbox.pdmodel.PDDocument
import org.apache.pdfbox.pdmodel.PDPage
import org.apache.pdfbox.pdmodel.common.PDStream
import org.apache.pdfbox.util.PDFOperator
@lyhcode
lyhcode / default.latex
Created January 1, 2014 10:15
pandoc default.latex sample
\documentclass[$if(fontsize)$$fontsize$,$endif$b5paper]{$documentclass$}
%\documentclass[$if(fontsize)$$fontsize$,$endif$twocolumn]{$documentclass$}
\usepackage[vmargin=$vmargin$,hmargin=$hmargin$]{geometry}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifxetex
\usepackage{fontspec,xltxtra,xunicode}
%\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\ifluatex
@lyhcode
lyhcode / sample1.groovy
Created November 15, 2013 07:26
Illustrate how to access data with KoobeCommonData using scripts
/**
* sample1.groovy - Koobe Scripting Project
*
* Illustrate how to access data with KoobeCommonData using scripts
*
* Usages:
* groovy sample1.groovy
*
* Required System Environment properties:
* JDBC_CONNECTION_STRING
/**
* HttpBuilder Testing
*/
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.2' )
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
def http = new HTTPBuilder( 'http://localhost:8080' )