Skip to content

Instantly share code, notes, and snippets.

@leandersonandre
leandersonandre / java_swing_jcombox.java
Created October 30, 2017 19:44
Exemplo de utilização do JComboBox.java
import java.awt.event.ItemEvent;
import javax.swing.*;
public class MainGUI extends JFrame{
public MainGUI(){
setTitle("Main GUI");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400,300);
@ulrikdamm
ulrikdamm / EditPrefab.cs
Last active May 14, 2024 16:41
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
public class EditPrefab {
static Object getPrefab(Object selection) {

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.

@Turupawn
Turupawn / 01_token.sol
Last active May 14, 2024 16:39
Scroll Workshop
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract SimpleToken is ERC20 {
constructor() ERC20("My Token", "MTK") {
uint initialSupply = 2_000_000_000;
_mint(msg.sender, initialSupply * 1 ether);
}
@xxRockOnxx
xxRockOnxx / laravel-tinker-login-session.md
Last active May 14, 2024 16:36
Laravel Tinker: login as another user and generate an injectable session cookie

Generating session cookie

  • Enter Laravel Tinker
php artisan tinker
  • Authenticate
@giovanni-d
giovanni-d / allinonemigration.md
Last active May 14, 2024 16:34
All-in-One WP Migration - Restore From Server (without PRO version) - Restore

All-in-One WP Migration Restore From Server (without pro version)

If you don't want to pay for the PRO version of this plugin, and you want to use the "Restore from Server" functionally that was present in the version 6.77, follow the instructions below:

  1. Open the js file: wp-content/plugins/all-in-one-wp-migration/lib/view/assets/javascript/backups.min.js
  2. On line 1208, replace the code below:
$('.ai1wm-backup-restore').click(function (e) {
@mkaranasou
mkaranasou / python_yaml_environment_variables.py
Last active May 14, 2024 16:33
Python Load a yaml configuration file and resolve any environment variables
import os
import re
import yaml
def parse_config(path=None, data=None, tag='!ENV'):
"""
Load a yaml configuration file and resolve any environment variables
The environment variables must have !ENV before them and be in this format
to be parsed: ${VAR_NAME}.
@mlabonne
mlabonne / finetune_llama2.py
Last active May 14, 2024 16:33
Easy Llama 2 fine-tuning script (📝 Article: https://tinyurl.com/finetunellama2)
# Based on younesbelkada/finetune_llama_v2.py
# Install the following libraries:
# pip install accelerate==0.21.0 peft==0.4.0 bitsandbytes==0.40.2 transformers==4.31.0 trl==0.4.7 scipy
from dataclasses import dataclass, field
from typing import Optional
import torch
from datasets import load_dataset
from transformers import (
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 14, 2024 16:33
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@johnbianchi
johnbianchi / pfctl-cheatsheet.txt
Last active May 14, 2024 16:31
pfctl cheat sheet
#### General PFCTL Commands ####
$ pfctl -d disable # packet-filtering
$ pfctl -e enable # packet-filtering
$ pfctl -q # run quiet
$ pfctl -v -v # run even more verbose
#### Loading PF Rules ####
$ pfctl -f /etc/pf.conf # load /etc/pf.conf
$ pfctl -n -f /etc/pf.conf # parse /etc/pf.conf, but dont load it
$ pfctl -R -f /etc/pf.conf # load only the FILTER rules
$ pfctl -N -f /etc/pf.conf # load only the NAT rules