Skip to content

Instantly share code, notes, and snippets.

View buttercutter's full-sized avatar

Phung Cheng Fei buttercutter

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@buttercutter
buttercutter / neopi.py
Last active January 11, 2023 06:08
A refactored neopi.py script
#!/usr/bin/python
# Name: neopi.py
# Description: Utility to scan a file path for encrypted and obfuscated files
# Authors: Ben Hagen (ben.hagen@neohapsis.com)
# Scott Behrens (scott.behrens@neohapsis.com)
#
# Date: 11/4/2010
#
# pep-0008 - Is stupid. TABS FO'EVER!
@buttercutter
buttercutter / run_summarization_flax.py
Last active January 11, 2023 03:24
flax training script with gradient accumulation trick
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team All rights reserved.
#
# 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
#
import imageio
import numpy as np
import torch
import torch.nn as nn
from torchvision.utils import make_grid
from torch.autograd import Variable
from torch.autograd import grad as torch_grad
import sequence_dataloader
@buttercutter
buttercutter / PKGBUILD
Created October 3, 2021 08:08
PKGBUILD for Modelsim
pkgname=modelsim
# Keep dot in _patchver
_mainver=20.1; _patchver=.1; _buildver=720
pkgver=${_mainver}${_patchver}.${_buildver}
pkgrel=1
# According to the installer script, these dependencies are needed for the installer
depends=('ld-lsb' 'lib32-expat' 'lib32-fontconfig' 'lib32-freetype2' 'lib32-glibc'
'lib32-gtk2' 'lib32-libcanberra' 'lib32-libpng' 'lib32-libice' 'lib32-libsm'

Version 4 SHEET 1 2232 772 WIRE -96 -240 -128 -240 WIRE 48 -240 -16 -240 WIRE 96 -240 48 -240 WIRE 224 -240 176 -240 WIRE 704 -192 704 -240 WIRE 1216 -192 1216 -240 WIRE 1728 -176 1728 -224 WIRE 1920 -176 1920 -224

@buttercutter
buttercutter / gdas.py
Last active June 29, 2022 00:20
GDAS : Searching for A Robust Neural Architecture in Four GPU Hours
# https://github.com/D-X-Y/AutoDL-Projects/issues/99
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
@buttercutter
buttercutter / Data_strobe_enable_circuitry.asc
Last active March 14, 2021 09:42
Circuit replication of "Data strobe enable circuitry" as described in https://patents.google.com/patent/US9001595

Version 4 SHEET 1 1032 900 WIRE -1408 -624 -1664 -624 WIRE -1248 -624 -1408 -624 WIRE -976 -624 -1184 -624 WIRE -1248 -592 -1408 -592 WIRE -1104 -592 -1184 -592 WIRE -1664 -544 -1664 -624 WIRE 640 -480 640 -560 WIRE 880 -480 880 -560

@buttercutter
buttercutter / darts.py
Created February 27, 2021 10:43
DARTS: DIFFERENTIABLE ARCHITECTURE SEARCH https://arxiv.org/pdf/1806.09055.pdf
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
import numpy as np
// Credit : https://github.com/YosysHQ/yosys-bigsim/blob/master/openmsp430/rtl/omsp_clock_gate.v
//----------------------------------------------------------------------------
// Copyright (C) 2009 , Olivier Girard
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright