Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
infamousjoeg / CYBRAutomation.md
Last active February 16, 2024 12:28
CyberArk Automation - Greatest Hits!
@korakot
korakot / folder_list.py
Last active January 31, 2023 15:33
List all files under a publicly-shared folder in Google Drive (in Colab), and download them
from google.colab import auth
auth.authenticate_user() # must authenticate
'''list all ids of files directly under folder folder_id'''
def folder_list(folder_id):
from googleapiclient.discovery import build
gdrive = build('drive', 'v3').files()
res = gdrive.list(q="'%s' in parents" % folder_id).execute()
return [f['id'] for f in res['files']]
@therightstuff
therightstuff / RSAKeys.cs
Last active November 3, 2023 16:34
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@MatthieuLemoine
MatthieuLemoine / crypto.js
Created January 23, 2017 14:36
Node crypto sign & verify
const id = '__JUNK__';
// Public key need to be in PKCS8 format
// ssh-keygen -e -m PKCS8 -f id_rsa.pub > id_rsa.pkcs8
const publicKey = fs.readFileSync(path.join(__dirname, 'id_rsa.pkcs8'), { encoding : 'utf8' });
const privateKey = fs.readFileSync(path.join(__dirname, 'id_rsa'), { encoding : 'utf8' });
// Sign
const signer = crypto.createSign('RSA-SHA512');
signer.update(id);
const signature = signer.sign(privateKey, 'hex');
@micklaw
micklaw / gist:6eb58988c2b587bbdc7d
Last active September 14, 2022 19:15
Screengrab a website c#
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace ScreenGrab.Core.Helpers
{
@DanielSWolf
DanielSWolf / Program.cs
Last active May 2, 2024 18:33
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@mariodivece
mariodivece / MakeComboBoxSearchable.cs
Created January 3, 2015 07:15
Makes a WPF ComboBox Searchable via its items
public static void MakeComboBoxSearchable(this ComboBox targetComboBox)
{
targetComboBox.Loaded += (ls, le) =>
{
targetComboBox.Items.IsLiveFiltering = true;
var targetTextBox = targetComboBox.Template.FindName("PART_EditableTextBox", targetComboBox) as TextBox;
if (targetTextBox == null) return;
targetComboBox.IsEditable = true;
@mvark
mvark / OAuthASPNETWebForms.cs
Created January 2, 2015 17:53
Authentication & Authorization using OAuth 2.0 Providers with ASP.NET WebForms: Code from Blaize Stewart's video tutorial "OAuth 2.0 Up and Running" (requires subscription), modified to include Microsoft's Live Connect functionality. See related blog posting - http://mvark.blogspot.in/2014/01/how-to-implement-authentication.html
/*
OAuthRedirectPage.aspx
==========================
<div>
<asp:Label ID="OAuthLabel" runat="server" Text="Label"></asp:Label>
</div>
OAuthRedirectPage.aspx.cs
==========================
*/
@thicknrich
thicknrich / yammer.user.js
Last active June 9, 2020 10:21
Yammer Remove Join Notifications
// ==UserScript==
// @name Yammer Remove Join Notifications
// @namespace https://www.yammer.com/
// @include https://www.yammer.com/stonybrook.edu/*
// @include https://www.yammer.com/stonybrook.edu#/Threads/index?type=algo
// @include https://www.yammer.com/stonybrook.edu#/*
// @version 1
// ==/UserScript==
@bmcbride
bmcbride / deleteFromImgur.js
Last active May 25, 2022 17:53
Upload image from HTML form to http://imgur.com/
function deleteFromImgur() {
$.ajax({
url: "https://api.imgur.com/3/image/{id}",
type: "DELETE",
headers: {
"Authorization": "Client-ID YOUR-CLIEND-ID-GOES-HERE"
},
success: function(response) {
//console.log(response);
}