Skip to content

Instantly share code, notes, and snippets.

View scottzach1's full-sized avatar
🐧

Zac Scott scottzach1

🐧
View GitHub Profile
@scottzach1
scottzach1 / redact.py
Last active June 25, 2024 22:11
A minimal wrapper to redact credentials in sys.stdout and sys.stderr
import io
import sys
class RedactIO(io.IOBase):
"""
A minimal io wrapper to redact sensitive data.
"""
def __init__(self, buffer, redactions: dict[str, str], **kwargs) -> None:
@dlqqq
dlqqq / ryzen_bug.md
Last active October 18, 2024 13:11 — forked from wmealing/C-states.md
AMD Ryzen "Freezing" Bug on GNU/Linux Systems

Random "Freezing" with AMD Ryzen CPUs

It seems that numerous GNU/Linux users (including myself) have been having issues with the system randomly "freezing" during light usage. From journalctl output and anecdotal accounts, it is speculated that the AMD Ryzen CPUs do not support other C-states for power management very well (at least on GNU/Linux distributions), and the freezing may be resolved by limiting the C-state of the CPU.

Possible Solution

Limiting the C-state of the CPU can be done through the addition of the following kernel boot parameter.

processor.max_cstate=1
def docx_replace(doc, data):
paragraphs = list(doc.paragraphs)
for t in doc.tables:
for row in t.rows:
for cell in row.cells:
for paragraph in cell.paragraphs:
paragraphs.append(paragraph)
for p in paragraphs:
for key, val in data.items():
key_name = '${{{}}}'.format(key) # use placeholders in the form ${PlaceholderName}
@ag-michael
ag-michael / FalconHuntqueries.md
Last active November 14, 2024 09:29
Falcon hunt queries

timestamp convert:


 convert ctime(timestamp/1000)

.top,.club,.xyz,.ru domain lookups where the amount of lookup for the domain is more than 1 and less than 4 per computer


aid=* event_simpleName=DnsRequest | regex DomainName=".*\.top$|.*\.club$|.*\.xyz$|.*\.ru$|[0-9]+.*\.\w$" | stats values(ComputerName) count by DomainName| where count <4 | sort – count
@claudiobizzotto
claudiobizzotto / downgrade-vbox-guest-additions.md
Last active November 3, 2022 07:39
Virtual Box conflicting guest additions ("Got different reports about installed GuestAdditions version") - Ubuntu 16.04

Downgrade Virtualbox guest additions in your virtual machine (Ubuntu 16.04)

Make sure your VM is running and ssh into it. From there, run the contents of downgrade-vbox-guest-additions.sh below.

Stop vagrant-vbguest automatic updates

From your host machine, if you have the vagrant-vbguest plugin installed, make sure you deactivate it for this specific VM. To do that, set auto_update to false in your Vagrantfile:

config.vbguest.auto_update = false
@nipunsadvilkar
nipunsadvilkar / Different_style_guide_python.md
Last active October 20, 2024 16:17
What is the standard Python docstring format?

Formats

Python docstrings can be written following several formats as the other posts showed. However the default Sphinx docstring format was not mentioned and is based on reStructuredText (reST). You can get some information about the main formats in that tuto.

Note that the reST is recommended by the PEP 287

There follows the main used formats for docstrings.

- Epytext

@RobertoSchneiders
RobertoSchneiders / elasticbeanstalk_deploy_iam_policy.md
Last active October 29, 2024 19:38
IAM Policy for deploy on Elastic Beanstalk

I am deploying with this IAM using Codeship and Circle CI to Elastic Beanstalk. I had a lot of trouble with this config. I talked to the aws support for about 6 hours until this worked properly, so, I guess it is worth to share.

UPDATE: In the end, I have to use the AWSElasticBeanstalkFullAccess policy. My custom policy keep breaking every week with some new added permission or some EB internal change. Anyway, the IAM I was using is below.

This works for me with CircleCI and EB Cli.

{
    "Version": "2012-10-17",
    "Statement": [
        {
@cobyism
cobyism / gh-pages-deploy.md
Last active November 11, 2024 00:02
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).