This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd app-dir | |
git pull | |
ps -ef| grep "dotnet run$" | tr -s " " | cut -d " " -f 2 | xargs kill | |
nohup dotnet run & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/a/41988979/10936088 | |
CREATE EXTENSION IF NOT EXISTS pgcrypto; | |
CREATE OR REPLACE FUNCTION generate_uid(size INT) RETURNS TEXT AS $$ | |
DECLARE | |
characters TEXT := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
bytes BYTEA := gen_random_bytes(size); | |
l INT := length(characters); | |
i INT := 0; | |
output TEXT := ''; | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.OpenApi.Any; | |
using Microsoft.OpenApi.Extensions; | |
using Microsoft.OpenApi.Interfaces; | |
using Microsoft.OpenApi.Models; | |
using NetTopologySuite.Features; | |
using NetTopologySuite.Geometries; | |
using Swashbuckle.AspNetCore.SwaggerGen; | |
namespace hello.Common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO $$ DECLARE | |
r RECORD; | |
BEGIN | |
FOR r IN (SELECT tablename FROM pg_tables WHERE (schemaname = current_schema() and tablename != 'spatial_ref_sys')) LOOP | |
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE'; | |
END LOOP; | |
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://blog.codetitans.pl/post/sending-ctrl-c-signal-to-another-application-on-windows/ | |
[DllImport("kernel32.dll", SetLastError = true)] | |
static extern bool AttachConsole(uint dwProcessId); | |
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] | |
static extern bool FreeConsole(); | |
[DllImport("kernel32.dll")] | |
static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate handler, bool add); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetStoreCapsLockMode False | |
CapsLock:: | |
{ | |
KeyWait "CapsLock" | |
time := A_TimeSinceThisHotkey | |
if (time > 300) { | |
SetTimer SendCaps, -4 | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
blog_path=~/path/to/blog | |
cd $blog_path | |
hugo new --editor typora posts/$1.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import tinify | |
tinify.key = "your key" | |
root = "./images" | |
dst_path = "./images-compress" | |
for origin, _, files in os.walk(root, topdown=False): | |
for name in files: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zipfile import ZipFile | |
from pathlib import Path | |
target_directory = "." | |
with ZipFile(src, 'r') as f: | |
for file_name in f.namelist(): | |
file_name = f.extract(file_name, path=target_directory) | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from botocore.client import Config | |
from rasterio.io import MemoryFile | |
session = boto3.session.Session() | |
client = session.client( | |
service_name="s3", | |
endpoint_url="http://localhost:9000", | |
aws_access_key_id='KEY', | |
aws_secret_access_key="SECRET" |