Skip to content

Instantly share code, notes, and snippets.

View suzuke's full-sized avatar

suzuke suzuke

  • Taiwan
View GitHub Profile
@suzuke
suzuke / UnmergedRanges.gs
Created December 16, 2020 09:33 — forked from erickoledadevrel/UnmergedRanges.gs
[Apps Script] Getting the unmerged ranges within a range
/**
* Gets all the unmerged ranges within a range.
* @param {SpreadsheetApp.Range} range The range to evaluate.
* @returns {SpreadsheetApp.Range[]} The unmerged ranges.
*/
function getUnmergedRanges(range) {
if (!range.isPartOfMerge()) {
return [range];
}
var mergedRanges = range.getMergedRanges();
@suzuke
suzuke / google-apps-script.md
Created December 16, 2020 09:35 — forked from labnol/google-apps-script.md
How to Learn Google Apps Script

Learning Google Apps Script

Find the best resources for learning Google Apps Script, the glue that connects all GSuite services including Gmail, Google Drive, Calendar, Google Sheets, Forms, Maps, Analytics and more.

A good place to learn more about Google Apps Script is the official documentation available at developers.google.com. Here are other Apps Script resources that will help you get up to speed.

  1. Google Apps Script Code Samples by Amit Agarwal
  2. Google Apps Script Development - Create Google Apps Script projects locally inside VS Code - video tutorial
  3. Awesome Google Scripts by Amit Agarwal
  4. Google Developer Experts - Follow Apps Scr
@suzuke
suzuke / ChunkyCache.gs
Created December 22, 2020 00:13 — forked from pilbot/ChunkyCache.gs
Using the Google Apps Script Cache Service for objects above 100Kb
function ChunkyCache(cache, chunkSize){
return {
put: function (key, value, timeout) {
var json = JSON.stringify(value);
var cSize = Math.floor(chunkSize / 2);
var chunks = [];
var index = 0;
while (index < json.length){
cKey = key + "_" + index;
chunks.push(cKey);
@suzuke
suzuke / md5.gs
Created January 5, 2021 07:32 — forked from KEINOS/md5.gs
GAS(Google Apps Script) user function to get MD5 hash or 4digit shortened hash for Multibyte(UTF-8, 2bytes character) environment.
/**
* ------------------------------------------
* MD5 function for GAS(GoogleAppsScript)
*
* You can get a MD5 hash value and even a 4digit short Hash value of a string.
* ------------------------------------------
* Usage1:
* `=MD5("YourStringToHash")`
* or
* `=MD5( A1 )` with the same string at A1 cell
@suzuke
suzuke / killbutmakeitlooklikeanaccident.bat
Created August 10, 2022 06:17 — forked from mbikovitsky/killbutmakeitlooklikeanaccident.bat
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
@"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe" -sins -y "srv*nul" -c "r rip = ntdll!NtTerminateProcess; r rcx = -1; r rdx = 0; r rsp = (@rsp & 0xFFFFFFFFFFFFFFF0) - 8; eq @rsp (-1); qd" -p %1
@suzuke
suzuke / FindNoxListeningPort.txt
Created August 15, 2022 03:16 — forked from edwardsmoses/FindNoxListeningPort.txt
Find Nox Listening Port in Windows CMD for adb devices connect.
for /f "tokens=2" %a in ('tasklist ^|findstr Nox.') do netstat -aon | findstr %a
---Link For Connecting Nox to Adb---
https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/
@suzuke
suzuke / modify.py
Created August 28, 2022 06:57
ELF Backdoor injector
from utils import parse_args
from parse import elf_info
from struct import pack
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.NOTSET)
class injector:
@suzuke
suzuke / Möller–Trumbore_intersection_algorithm
Created September 12, 2018 02:21
Möller–Trumbore_intersection_algorithm with fixedpoint
//https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
private bool RayIntersectsTriangle(ISupportMappable support, ref TSMatrix orientation, ref TSMatrix invOrientation,
ref TSVector position, ref TSVector origin, ref TSVector direction, out FP fraction, out TSVector normal)
{
FP EPSILON = FP.EN8;
fraction = FP.Zero;
normal = TSVector.zero;
TriangleMeshShape inTriangle = support as TriangleMeshShape;
TSVector[] vertices = inTriangle.Vertices;
import subprocess
import openai
import re
from collections import defaultdict
import textwrap
import time
import shlex
openai.api_key = open("./openai_key.txt", "r").read().strip("\n")