Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Septdir
Septdir / README.md
Last active April 23, 2024 09:19
Joomla! 5.1 Control panel change color scheme.

Русский

Создайте модуль HTML для панели управления в позиции status и вставите туда код

English

Create an HTML module for the control panel in the 'status' position and insert the code there.

@dastergon
dastergon / ec2_info_retriever.py
Last active April 23, 2024 09:19
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@lucasrenan
lucasrenan / k8s.sh
Created April 30, 2019 17:50
Kubernetes get all pods/containers resources requests/limits
kubectl get pods --all-namespaces --sort-by='.metadata.name' -o jsonpath='{.items[*].spec.containers[*].resources.limits.memory}'
kubectl get pod --all-namespaces --sort-by='.metadata.name' -o json | jq -r '[.items[] | {pod_name: .metadata.name, containers: .spec.containers[] | [ {container_name: .name, memory_requested: .resources.requests.memory, cpu_requested: .resources.requests.cpu} ] }]'
@mattlewissf
mattlewissf / add-p.md
Last active April 23, 2024 09:19
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@iampaul83
iampaul83 / READMD.md
Last active April 23, 2024 09:19
Spring Data JPA Enum converter

Spring Data JPA Enum converter

Column 使用 NUMBER 型別,如何在 JPA 中用 Enum 做 mapping,且不使用 @Enumerated(EnumType.ORDINAL)

CREATE TABLE CHALLENGE_LOG (
  ACTION NUMBER(1) NOT NULL
);
COMMENT ON COLUMN CHALLENGE_LOG.ACTION IS '0=Send OTP, 1=Verify OTP';
@mcollina
mcollina / publish.sh
Created August 12, 2022 22:22
npm workspace publish
#!/bin/sh
VERSION=$1
MODULES=`node -e "console.log(require('./package.json').workspaces.join(' '))"`
for MODULE in $MODULES; do
echo "Building $MODULE"
pushd $MODULE
npm version $VERSION --save
NAME=`node -e "console.log(require('./package.json').name)"`
@zhuziyi1989
zhuziyi1989 / URL Schemes.md
Last active April 23, 2024 09:18
常用 URL Schemes 收集。

** 由于此文年事已久,可能某些URL Schemes已失效,可在评论区留言指出!(最后更新于 2024.4.16)

关于 URL Scheme 你知道多少?

iOS系统中

由于苹果的各应用都是在沙盒中,不能够互相之间访问或共享数据。但是苹果还是给出了一个可以在APP之间跳转的方法:URL Scheme。简单的说,URL Scheme就是一个可以让 APP 相互之间可以跳转的协议。每个 APP 的URL Scheme都是不一样的,如果存在一样的URL Scheme,那么系统就会响应先安装那个 APP 的URL Scheme,因为后安装的 APP 的URL Scheme被覆盖掉了,是不能被调用的。

Android系统中

@adityawarmanfw
adityawarmanfw / duckdb__dim_date.sql
Last active April 23, 2024 09:17
Generate Date Dimension table in DuckDB
WITH generate_date AS (
SELECT CAST(RANGE AS DATE) AS date_key
FROM RANGE(DATE '2009-01-01', DATE '2013-12-31', INTERVAL 1 DAY)
)
SELECT date_key AS date_key,
DAYOFYEAR(date_key) AS day_of_year,
YEARWEEK(date_key) AS week_key,
WEEKOFYEAR(date_key) AS week_of_year,
DAYOFWEEK(date_key) AS day_of_week,
ISODOW(date_key) AS iso_day_of_week,
@yasirkula
yasirkula / ScrollViewFocusFunctions.cs
Created October 23, 2021 10:09
Focus/center Scroll View to the specified point/item in Unity
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public static class ScrollViewFocusFunctions
{
public static Vector2 CalculateFocusedScrollPosition( this ScrollRect scrollView, Vector2 focusPoint )
{
Vector2 contentSize = scrollView.content.rect.size;
Vector2 viewportSize = ( (RectTransform) scrollView.content.parent ).rect.size;