Skip to content

Instantly share code, notes, and snippets.

@nerdsrescueme
nerdsrescueme / regex.txt
Created September 23, 2011 16:08
Common Regex
View regex.txt
Perl and PHP Regular Expressions
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
//All major credit cards regex
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/'
@atomize
atomize / GASjson2SS.js
Last active December 11, 2023 21:26 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
View GASjson2SS.js
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = Utilities.jsonParse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
View Vagrant network config : NAT + NAT network + HostOnly
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@doraTeX
doraTeX / ocr.sh
Last active December 11, 2023 21:23
A shell script to perform OCR on images/PDFs using macOS built-in OCR engine
View ocr.sh
#!/bin/bash
SCRIPTNAME=$(basename "$0")
function realpath () {
f=$@;
if [ -d "$f" ]; then
base="";
dir="$f";
else
base="/$(basename "$f")";
@ihsangan
ihsangan / index.js
Last active December 11, 2023 21:21
Send email from Workers with MailChannel API
View index.js
async function readRequestBody(request) {
const { headers } = request;
const contentType = headers.get('content-type') || '';
if (contentType.includes('application/json')) {
return JSON.stringify(await request.json());
} else if (contentType.includes('form')) {
const formData = await request.formData();
const body = {};
for (const entry of formData.entries()) {
body[entry[0]] = entry[1];
@amulyakashyap09
amulyakashyap09 / elastic_search_query.md
Last active December 11, 2023 21:10
How to query in elastic-search
View elastic_search_query.md

Terminologies

We will be using following information throughout this article:

  • index_name : customers
  • index_type : personal
  • customer will have name,age,gender,email,phone,address,city,state as fields in schema for now

INFO Queries

@jhermsmeier
jhermsmeier / windows-keys.md
Last active December 11, 2023 21:10
Windows Product Keys
View windows-keys.md

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

@HStep20
HStep20 / tag_sonarr_radarr_media_with_overseer_users.py
Last active December 11, 2023 21:07
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances
View tag_sonarr_radarr_media_with_overseer_users.py
"""
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances, then create a filter in each connected -arr application for the users you specify.
It is forward compatible with the future User Tagging feature of overseer, and formats the tag in the same 'id - lowercase username' pattern Overseer will
It only uses built in python libraries, so you should be able to download and run without much hassle.
NOTE: YOU ARE REQUIRED TO USE IP:PORT CONNECTIONS FOR YOUR SONARR/RADARR INSTANCES INSIDE OF OVERSEERR
This will NOT utilize docker-compose style hostnames at the moment, and I don't use them personally, so I don't see myself adding them
Steps to use:
@nirbhayph
nirbhayph / Circles.kt
Last active December 11, 2023 21:06
Google Maps and Jetpack Compose
View Circles.kt
@Composable
fun CircleMap() {
// Define the coordinates for circle centers and their associated information
val circleData = listOf(
CircleInfo("Park A", LatLng(37.7749, -122.4194), "This is Park A"),
CircleInfo("Park B", LatLng(36.7783, -119.4179), "This is Park B"),
CircleInfo("Park C", LatLng(34.0522, -118.2437), "This is Park C")
)
// Create a mutable state to track the selected circle
@DaniJG
DaniJG / .github_actions_databricks-cli-install_action.yaml
Last active December 11, 2023 21:04
Github actions for databricks
View .github_actions_databricks-cli-install_action.yaml
name: 'databricks-cli-install'
description: 'Install latest version of the databricks CLI'
runs:
using: "composite"
steps:
# this is the new CLI, distributed as a standalone executable that doesnt need Python: https://docs.databricks.com/dev-tools/cli/databricks-cli.html
- shell: bash
run: |
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh