Skip to content

Instantly share code, notes, and snippets.

Avatar

CapacitorSet CapacitorSet

View GitHub Profile
@CapacitorSet
CapacitorSet / gem5_alpha.md
Created Nov 5, 2020
Compiling ALPHA support on gem5
View gem5_alpha.md

Compiling ALPHA support on gem5

To build support for ALPHA on gem5 you essentially need to compile v19 in the correct environment, which can be difficult due to Python incompatibilities. Here are the steps I took:

git clone https://github.com/ArturKlauser/gem5-dev
docker build -t gem5-dev gem5-dev/docker
git clone https://gem5.googlesource.com/public/gem5
export GEM5_WORKDIR=~/gem5
cd gem5
@CapacitorSet
CapacitorSet / add8.cpp
Created Sep 10, 2019
8 bit adder for Glovebox
View add8.cpp
void add8(gb::bitvec<8> out, bit_t overflow, const gb::bitvec<8> a,
const gb::bitvec<8> b) {
bit_t _00_ = make_bit();
_nor(_00_, a[7], b[7]);
bit_t _01_ = make_bit();
_nand(_01_, a[6], b[6]);
bit_t _02_ = make_bit();
_nand(_02_, a[5], b[5]);
bit_t _03_ = make_bit();
_nand(_03_, a[4], b[4]);
@CapacitorSet
CapacitorSet / webhook-server.go
Created Mar 11, 2019
A tiny webhook server that runs a bash script upon pushes to master.
View webhook-server.go
package main
import (
"log"
"net/http"
"os"
"os/exec"
"gopkg.in/go-playground/webhooks.v5/github"
)
@CapacitorSet
CapacitorSet / oid.go
Created Jul 8, 2018
Parse OIDs in Go
View oid.go
// https://www.snmpsharpnet.com/?p=153
oid := []uint32{
uint32(oidBytes[0]) / 40,
uint32(oidBytes[0]) % 40,
}
for i := 1; i < len(oidBytes); {
bbyte := oidBytes[i]
// Short form
if bbyte & 0x80 == 0 {
oid = append(oid, uint32(bbyte))
View uglify.js
// A standalone script that replicates the preprocessing stage in box-js.
const unsafe = true;
const code = require("fs").readFileSync(process.argv[2], "utf8");
const result = require("uglify-es").minify(code, {
compress: {
passes: 3,
booleans: true,
cascade: true,
View Lancio della moneta.au3
; Note: this is my first AutoIt script, which I archived for historical reasons.
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.0
Author: myName
Script Function:
Template AutoIt script.
View spawnSync.js
// Source: https://github.com/nodejs/node/blob/master/lib/child_process.js
// Defines spawn_sync and normalizeSpawnArguments (without error handling). These are internal variables.
spawn_sync = process.binding('spawn_sync'); normalizeSpawnArguments = function(c,b,a){if(Array.isArray(b)?b=b.slice(0):(a=b,b=[]),a===undefined&&(a={}),a=Object.assign({},a),a.shell){const g=[c].concat(b).join(' ');typeof a.shell==='string'?c=a.shell:c='/bin/sh',b=['-c',g];}typeof a.argv0==='string'?b.unshift(a.argv0):b.unshift(c);var d=a.env||process.env;var e=[];for(var f in d)e.push(f+'='+d[f]);return{file:c,args:b,options:a,envPairs:e};}
// Defines spawnSync, the function that will do the actual spawning
spawnSync = function(){var d=normalizeSpawnArguments.apply(null,arguments);var a=d.options;var c;if(a.file=d.file,a.args=d.args,a.envPairs=d.envPairs,a.stdio=[{type:'pipe',readable:!0,writable:!1},{type:'pipe',readable:!1,writable:!0},{type:'pipe',readable:!1,writable:!0}],a.input){var g=a.stdio[0]=util._extend({},a.stdio[0])
View server.go
// A one-time server. It serves a file with the format "uuid.7z.dat" and deletes it after 5 minutes since the first access.
/*
Copyright 2017 CapacitorSet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
View .clang-format
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
View keybase.md

Keybase proof

I hereby claim:

  • I am capacitorset on github.
  • I am capacitorset (https://keybase.io/capacitorset) on keybase.
  • I have a public key ASDkwL4VZiUCkNR7yfFYv8c1Iz27eKKNds3VF7yhNadM1Ao

To claim this, I am signing this object:

You can’t perform that action at this time.