Skip to content

Instantly share code, notes, and snippets.

@zchee
zchee / actionlist.vim
Last active June 23, 2024 17:32
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@ljyf5593
ljyf5593 / email_validation
Created June 19, 2014 02:50
常用邮箱有效性正则规则
<?php
$reg_arr = array(
'^[0-9]{5,11}@qq\.com', // 以QQ号码为邮箱 5至11个数字
'^[a-z][a-z0-9.-_]{1,16}[a-z0-9]@(qq|foxmail)\.com', // QQ邮箱别名 3至18个英文、数字、点、减号、下划线,以英文字母开头,以英文数字结尾
'^[a-z0-9][a-z0-9_]{2,14}[a-z0-9]@sina\.(com|cn)', // 新浪 4至16个英文、数字、下划线,下划线不能在首尾
'^[a-z][a-z0-9_]{4,16}[a-z0-9]@(((163|126)\.com)|(yeah\.net))', // 网易字母邮箱,6-18字母、下划线、数字,字母开头,字母数字结尾
'^1[3|4|5|8][0-9]{9}@(163|139)\.com', // 网易手机邮箱和手机邮箱
'^[a-z0-9][a-z0-9.]{4,28}[a-z0-9]@gmail\.com', // gmail 6-30
'^[a-z][a-z0-9._]{6,30}[a-z0-9]@yahoo\.com', // 雅虎邮箱
'^[a-z][a-z0-9.-_]{3,15}@sohu.com', // 搜狐邮箱
@bencord0
bencord0 / system_uuid.sh
Last active August 31, 2023 11:51
Unique id for a linux system
#!/bin/bash
cat /var/lib/dbus/machine-id && exit
# Provided by dbus, hence available on all systemd systems.
# Any user can read it and it is persistent accross boots.
# It is unique per installation, and works well in VMs.
# Not all systems (i.e. stage3 gentoo/handbook install)
# have dbus installed by default.
cat /sys/class/dmi/id/product_uuid && exit
@kylefox
kylefox / color.m
Created January 27, 2012 17:45
Generate a random color (UIColor) in Objective-C
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@karthick18
karthick18 / splice.c
Created September 22, 2011 06:31
An example copy of a file to output file using the splice syscall that avoids copying to/from user space buffers to kernel space by employing pipe buffers allocated in kernel space for fast data transfers between 2 files
/*
* An example using splice syscall which avoids copying to/from user space buffers to kernel space
* and uses the pipe buffers allocated in kernel space as an intermediate to directly xfer from one file to another
*
* gcc -o splice splice.c -g
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>