Skip to content

Instantly share code, notes, and snippets.

借助git快速批量转换CRLF到LF


换行符的差异

  • windows下每行结尾为回车+换行(CR+LF),即 \r\n
  • unix和macOS下每行结尾为换行LF,即 \n
  • classic macOS(最后一个版本为1999年发布的Mac OS 9,可忽略)下为回车,即 \r

设置jetbrain系IDE

settings > Editor > Code Style > Line Separator > unix and macOS (\n)

@CodeSigils
CodeSigils / ubuntu-remove-telemetry.sh
Last active May 13, 2024 07:24
Remove Ubuntu telemetry
#!/usr/bin/env bash
################ Description: ###################
# This script will disable all opt-out under
# Ubuntu 22.04 (Codename: Jammy Jellyfish).
# At first the telemetry domains will be resolved
# to the local host and second all telemetry services
# will be removed from the system.
# The following work has a system-wide effect not just
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@ryanlintott
ryanlintott / ContentView.swift
Last active May 13, 2024 07:20
A SwiftUI environment value for the keyboard height that updates with animation. This is useful when you want a specific view in a stack to stick to the bottom of the keyboard when the keyboard moves up.
import SwiftUI
struct ContentView: View {
var body: some View {
KeyboardAvoidingWithOffset()
.keyboardHeightEnvironmentValue()
}
}
struct KeyboardAvoidingWithOffset: View {
@svandragt
svandragt / csv2bm.py
Last active May 13, 2024 07:20
Convert (Instapaper) CSV to Netscape Bookmark File
#!/usr/bin/env python
"""
Convert CSV to Netscape Bookmark File
Works for files exported by Instapaper.
author: Sander van Dragt <sander@vandragt.com>
version: 2019-10-23.01
"""
import csv
from sys import argv
@h6y3
h6y3 / enophone_afterlife.md
Last active May 13, 2024 07:19
Enophone login workaround and client download

Enophone login workaround and client download

If you have found this link, then you know what this. I was fortunate to reach the founders on the Internet to ascertain ways in which those who of us who have working headset can still continue to use the device now that the servers have been deprovisioned.

First, if you do not have the latest client, I have secured the clients and hosted them on Mediafire here:

@joseluisq
joseluisq / resize_disk_image.md
Last active May 13, 2024 07:16
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@chalg
chalg / great_tables_co2.py
Last active May 13, 2024 07:15
Showcase electricity consumption data for 2023 from ElectricityMaps via Python great_tables
from great_tables import GT, md, html, system_fonts
import pandas as pd
power_cie_prepared_tbl = pd.read_csv("./data/2023_cie_power_cons.csv")
# Create a Great Tables object
ciep_gt_tbl = GT(data=power_cie_prepared_tbl)
# Apply wider color ranges & formatting
gt_tbl = ciep_gt_tbl \
@AlShevelev
AlShevelev / gist:ea43096e8f66b0ec45a0ec0dd1e8cacc
Created June 24, 2019 05:40
ViewPager2 extension for reducing drag sensitivity
/**
* Reduces drag sensitivity of [ViewPager2] widget
*/
fun ViewPager2.reduceDragSensitivity() {
val recyclerViewField = ViewPager2::class.java.getDeclaredField("mRecyclerView")
recyclerViewField.isAccessible = true
val recyclerView = recyclerViewField.get(this) as RecyclerView
val touchSlopField = RecyclerView::class.java.getDeclaredField("mTouchSlop")
touchSlopField.isAccessible = true