Skip to content

Instantly share code, notes, and snippets.

@wrighter
wrighter / download_bars.py
Last active May 3, 2024 21:38
A command line utility to download historical data from Interactive Brokers
#!/usr/bin/env python
import os
import sys
import argparse
import logging
from datetime import datetime, timedelta
from typing import List, Optional
from collections import defaultdict

GitHub Search Syntax for Finding API Keys/Secrets/Tokens

As a security professional, it is important to conduct a thorough reconnaissance. With the increasing use of APIs nowadays, it has become paramount to keep access tokens and other API-related secrets secure in order to prevent leaks. However, despite technological advances, human error remains a factor, and many developers still unknowingly hardcode their API secrets into source code and commit them to public repositories. GitHub, being a widely popular platform for public code repositories, may inadvertently host such leaked secrets. To help identify these vulnerabilities, I have created a comprehensive search list using powerful search syntax that enables the search of thousands of leaked keys and secrets in a single search.

Search Syntax:

(path:*.{File_extension1} OR path:*.{File_extension-N}) AND ({Keyname1} OR {Keyname-N}) AND (({Signature/pattern1} OR {Signature/pattern-N}) AND ({PlatformTag1} OR {PlatformTag-N}))

Examples:

**1.

@SynCap
SynCap / remove_node_modules_recursively.ps1
Last active May 3, 2024 21:37
Remove `node_modules` folders in Windows in all subfolders recursively with PowerShell to avoid exceeding path max_length
<#
Note: Eliminate `-WhatIf` parameter to get action be actually done
Note: PS with version prior to 4.0 can't delete non-empty folders
#>
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf
@c141charlie
c141charlie / Program.fs
Created October 18, 2010 22:49
Use F# to extract information from multiple Excel files
//If you're running this code using F# REPL then you have to do run this command:
//#r "C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll"
//Open up the correct namespace
open Microsoft.Office.Interop.Excel
//Open Excel
let xl = new ApplicationClass(Visible = true)
@interactivetech
interactivetech / pycocotools_tutorial.ipynb
Created January 17, 2021 22:10
Detailed Walkthrough of pycocotools and Python COCO API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@davidrjonas
davidrjonas / flatmap.php
Last active May 3, 2024 21:29
Simple flatmap() or mapcat() for PHP 7
<?php
/**
* If you need something safer or more complete see https://github.com/lstrojny/functional-php,
* in particular, https://github.com/lstrojny/functional-php/blob/master/src/Functional/FlatMap.php
*
* @param Callable $fn Mapping function that returns an array
* @param array $array Data over which $fn will be mapped
* @return array
*/
@pgaskin
pgaskin / PrintRevealNotes.js
Last active May 3, 2024 21:23
Prints speaker notes for a reveal.js presentation.
/*
Prints speaker notes for a reveal.js presentation.
To print the notes, run the js function PrintRevealNotes()
You need to disable the pop-up blocker
Copyright 2016 Patrick G
http://geek1011.github.io
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@Softwave
Softwave / README.md
Last active May 3, 2024 21:22
Fibonacci Program

Fib

Simple fibonacci number calculator.

Usage: fib nth Fibonacci number