Skip to content

Instantly share code, notes, and snippets.

@Apoc70
Apoc70 / Set-TLS12.ps1
Last active May 17, 2024 16:15
PowerShell script to enable TLS 1.2 in preparation for Entra ID Connect, and to disable legacy TLS for Exchange Server 2019.
param (
[switch]$DisableLegacyTls
)
# Last updated: 2024-02-21
if($DisableLegacyTls) {
# Disable TLS 1.0 and 1.1
# Following https://learn.microsoft.com/exchange/plan-and-deploy/post-installation-tasks/security-best-practices/exchange-tls-configuration?view=exchserver-2019&WT.mc_id=M365-MVP-5003086
# Disable TLS 1.0
@DragoshDX
DragoshDX / app.css
Created April 30, 2024 07:24
pedro spinner
body {
background: #161616;
margin: 0;
height: 100dvh;
display: grid;
place-content: center center;
}
.spinner {
@eddanger
eddanger / basecamp2github.rb
Created December 8, 2011 05:23 — forked from chip/basecamp2github.rb
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
GITHUB_USERNAME = '__GITHUB_USERNAME__'
GITHUB_PASSWORD = '__GITHUB_PASSWORD__'
GITHUB_ORG = '__GITHUB_ORG__'
GITHUB_REPO = '__GITHUB_REPO__'
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 16:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@jbransen
jbransen / a-transip-zone-export.php
Last active May 17, 2024 16:08
Exporting a DNS Zone file from the TransIP API
<?php
require __DIR__ . '/vendor/autoload.php';
use Badcow\DNS\Zone;
use Badcow\DNS\Rdata\Factory;
use Badcow\DNS\ResourceRecord;
use Badcow\DNS\AlignedBuilder;
// Login details, fill those in with your TransIP username, the file containing
// your private key, and the domain you would like to export
Transip_ApiSettings::$login = "<username>";
@sagamantus
sagamantus / zerodha_request_token.py
Last active May 17, 2024 16:06
Automating the process of obtaining a request token for the Kite Connect API using the provided credentials and the KiteConnect library.
import requests
import re
import onetimepass as otp
from urllib.parse import urlparse, parse_qs
from kiteconnect import KiteConnect
def get_request_token(credentials: dict) -> str:
"""Use provided credentials and return request token.
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
#!/bin/bash
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install nvm (Node Version Manager)
echo "Installing nvm..."
@moorage
moorage / gmail_batch_fetch.ts
Created August 28, 2023 21:14
How to fetch gmail in batch with javascript / typescript
const gmailBatchEndpoint = 'https://www.googleapis.com/batch/gmail/v1'
const batchLimit = 2
async function fetchFullMessages(
auth: OAuth2Client,
messageIds: string[] = []
) {
const messageQueries = messageIds.map(function (id) {
return { uri: '/gmail/v1/users/me/messages/' + id }