Skip to content

Instantly share code, notes, and snippets.

@maxpollard
maxpollard / momChangesByUser.sql
Created August 4, 2023 22:05
Sensitive Content queries using Snowflake + Material
CREATE OR REPLACE FUNCTION EXTRACT_RULE_ID(versionedRuleId STRING)
RETURNS STRING
LANGUAGE JAVASCRIPT
AS 'return versionedRuleId.substring(0, versionedRuleId.indexOf("@") - 1);';
CREATE OR REPLACE FUNCTION GET_DISTINCT_RULES_MATCHED(arr1 ARRAY, arr2 ARRAY)
RETURNS ARRAY
LANGUAGE JAVASCRIPT
AS '
var result = [];
@jareware
jareware / SCSS.md
Last active April 23, 2024 22:13
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@matthen
matthen / hello_world.py
Last active April 23, 2024 22:13
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List
@mihow
mihow / load_dotenv.sh
Last active April 23, 2024 22:07
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@t27
t27 / linux-oom-killer-fixes.md
Last active April 23, 2024 22:07
Dealing with the Linux OOM Killer

Dealing with the Linux OOM Killer at the program level

Do this in cases when you dont want to change the os-level settings, but only want to disable the OOM killer for a single process. This is useful when youre on a shared machine/server.

The OOM killer uses the process level metric called oom_score_adj to decide if/when to kill a process. This file is present in /proc/$pid/oom_score_adj. The oom_score_adj can vary from -1000 to 1000, by default it is 0.

You can add a large negative score to this file to reduce the probability of your process getting picked and terminated by OOM killer. When you set it to -1000, it can use 100% memory and still avoid getting terminated by OOM killer.

@karljuhlpep
karljuhlpep / dspy_codegen.py
Last active April 23, 2024 22:04
DSPy Module - CodeGen + Debugging
import subprocess
import dspy
### Note this code is not tested, and likely includes errors that need to be refined.
class IterativeCodeRefinement(dspy.Module):
def __init__(self):
super().__init__()
self.generate_pseudocode = dspy.ChainOfThought("task -> pseudocode")
@Bill-Stewart
Bill-Stewart / Get-ADGroupMembership.ps1
Created December 2, 2019 19:44
Get-ADGroupMembership.ps1
# Get-ADGroupMembership.ps1
# Written by Bill Stewart
#requires -version 2
# Version history:
# 1.0 (2019-12-02)
# * Initial version. Only searches the current domain.
<#
@jtmoon79
jtmoon79 / python-embedded-for-Win10.md
Last active April 23, 2024 21:57
fully configuring embedded Python on Windows 10

Update: use PowerShell script PythonEmbed4Win.ps1.

The instructions in this gist have some subtle problems and this gist will not be updated.

About


@JustinByrne
JustinByrne / laravel-ci-cd-workflow.yml
Last active April 23, 2024 21:55
Github Action to test laravel and then compile the assets to a production branch
name: CI/CD workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
testing:
@dhrp
dhrp / docker
Created June 8, 2013 02:15
this is the docker ascii logo
Docker logo
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/