Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://en.wikipedia.org/wiki/Reuleaux_triangle | |
import math | |
import cairo | |
def pos_on_circle(cx, cy, radius, angle): | |
# Convert polar to cartesian, Author: Matthew Schweiss | |
x = math.cos(angle) * radius + cx | |
y = math.sin(angle) * radius + cy | |
return x, y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JAVA="java" | |
JAR="paper-1.18.1-101.jar" | |
RAM="2000M" | |
FLAGS="-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Daikars.new.flags=true -Dusing.aikars.flags=https://mcflags.emc.gs" | |
echo "Starting server..." | |
${JAVA} -Xmx${RAM} -Xms${RAM} ${FLAGS} -jar ${JAR} --nogui |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import array | |
def test_signed(typecode): | |
try: | |
a = array.array(typecode) | |
# Create byte representation of exactly one item | |
byte_item = bytes() | |
for i in range(a.itemsize): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Deletes all symbols in Ghidra Symbol Tree | |
Not necessary for this demonstration, but useful for testing. | |
""" | |
symbolTable = currentProgram.getSymbolTable() | |
for sym in symbolTable.getSymbolIterator(): | |
sym.delete() | |
currentProgram.invalidate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ghidra.app.script.GhidraScript; | |
public class PrintHangTest extends GhidraScript { | |
long STALL_TIME = 60 * 1000; // milliseconds | |
@Override | |
public void run() throws Exception { | |
if (currentProgram == null) { | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Iterator Example | |
* Modified to support clang compiler | |
* Compiler and Run: | |
* $ clang++ -Wall -Ofast -std=c++11 iterator_test.cpp && ./a.out | |
* y | |
* y | |
* time1: 143ns | |
* time2: 168ns | |
* https://softwareengineering.stackexchange.com/questions/386614/c-iterator-why-is-there-no-iterator-base-class-all-iterators-inherit-from | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# TCP Port Forwarding via Socks5 Socket | |
# Original Author : WangYihang <[email protected]> (for port forwarding) | |
# (As gist: <https://gist.github.com/WangYihang/e7d36b744557e4673d2157499f6c6b5e>) | |
# Changes : NeoAtlantis <[email protected]> | |
# (adapted to pySocks, argparse for CLI invokation, encryption, etc.) | |
import argparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Diagnose script for checking OS/hardware/python/pip/mxnet. | |
The output of this script can be a very good hint to issue/problem. | |
""" | |
import platform, subprocess, sys, os | |
def check_python(): | |
print('----------Python Info----------') | |
print('Version : ' + platform.python_version()) | |
print('Compiler : ' + platform.python_compiler()) | |
print('Build : ' + ', '.join(platform.python_build())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L,S,O,R,F=len,set,None,range,frozenset | |
U,N,J,D,I=S.update,F.union,F.isdisjoint,F.difference,F.intersection | |
def r(n,a,c): | |
U(c,P) | |
if L(I(N(Q[n],C[n]),a))<2:return 1 | |
w=D(P,N(a,[n]));e=S();u=S([next(iter(w))]) | |
while u:n=I(Q[u.pop()],w);U(u,D(n,e));U(e,n) | |
return L(e)==L(w) | |
def T(a,o,i,c,k): | |
s,p,m=a |