Skip to content

Instantly share code, notes, and snippets.

@xgqfrms
xgqfrms / 如何使用 macOS 剪切文件的方法汇总.md
Created April 25, 2024 15:29
如何使用 macOS 剪切文件的方法汇总

如何使用 macOS 剪切文件的方法汇总

  1. 在多个 Finder 窗口间,直接拖拽文件

  2. 使用快捷键 Option + Command + V 剪切文件

@KlassenKonstantin
KlassenKonstantin / RubberBandSlider.kt
Created January 15, 2024 17:16
Rubber Band Slider Compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
RubberBandSliderTheme {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
Box(contentAlignment = Alignment.Center) {
RubberBandSlider(modifier = Modifier
.height(200.dp)

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A
@hlorand
hlorand / vidstab_ffmpeg.md
Last active April 25, 2024 15:26
Video stabilization using VidStab and FFMPEG

Video stabilization using VidStab and FFMPEG

** Step 1 **

Install ffmpeg with the vidstab plugin.

@hyperdefined
hyperdefined / cobalt.md
Last active April 25, 2024 15:26
cobalt instance dump I found online

How did you find these?

I used a service called Censys Search to find them. There's some queries you can do:

  • services.http.response.html_title: "cobalt"
    • This one can find web instances. Does lead to false positives, since any title can contain "cobalt."
  • services.http.response.body_hash="sha1:bf53b9ab96065ed263df9ebcd2b3b0c4d88242b5"
    • This one can find API instances. This is the hash of the response that all instances use.
  • You can probably also look for just port 9001/9000, but most of these ports are not default.

After I collected the list, I checked /api/serverInfo on the API instances to see if it has a url set. This can either be a subdomain or an IP. If it had a domain set, I tried to find the web instance by checking common subdomains (like co, cobalt, etc). If there were no connecting domains, I tried a look up the IP on SecurityTrails. Otherwise, it simply got listed as the IP.

@zmts
zmts / tokens.md
Last active April 25, 2024 15:23
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@derekconjar
derekconjar / wordpress-firebase.php
Last active April 25, 2024 15:21
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@jonnymaceachern
jonnymaceachern / batch-convert-mp4-webm.sh
Created August 28, 2019 14:59
Batch convert mp4 to webm using ffmpeg
for i in *.mp4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 "${name}.webm"
done
func encode<T>(var value: T) -> NSData {
return withUnsafePointer(&value) { p in
NSData(bytes: p, length: sizeofValue(value))
}
}
func decode<T>(data: NSData) -> T {
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type))
data.getBytes(pointer)
@Hardikanand1st
Hardikanand1st / Aomei all editions product keys.md
Last active April 25, 2024 15:19
Free Product Keys For Aomei All Editions

Discord Username

Hardik#8032

Logo

Aomei Product Keys.