Skip to content

Instantly share code, notes, and snippets.

View megabitsenmzq's full-sized avatar
🍤
金鱼不可以吃哦!

Jinyu Meng megabitsenmzq

🍤
金鱼不可以吃哦!
View GitHub Profile
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@EmilHernvall
EmilHernvall / data2sound.py
Created September 29, 2011 14:07
Encode data as sound, and retrieve it using a FFT
class GlobalFormat(object):
def __init__(self):
self.id = 0x46464952 # RIFF
self.size = 0
self.type = 0x45564157 # WAVE
def as_bin(self):
return struct.pack("III", self.id, self.size, self.type)
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@andrzejressel
andrzejressel / aria2
Created January 2, 2014 10:37
init.d file for aria2c daemon (debian)
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c init script.
@iahu
iahu / safari-touchemulator.user.js
Created December 17, 2015 14:58
emulate touch events of safari(with iOS userAgent)
// ==UserScript==
// @name emulator_touch_events
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author author (uses https://github.com/hammerjs/touchemulator)
// @match http://tampermonkey.net/index.php?version=3.13.4890&ext=G3XV&updated=true
// @match *://*/*
// @grant none
// ==/UserScript==

Linux 命令行编辑快捷键

初学者在Linux命令窗口(终端)敲命令时,肯定觉得通过输入一串一串的字符的方式来控制计算是效率很低。 但是Linux命令解释器(Shell)是有很多快捷键的,熟练掌握可以极大的提高操作效率。 下面列出最常用的快捷键,这还不是完全版。

  • 命令行快捷键:
    • 常用:
      • Ctrl L :清屏
  • Ctrl M :等效于回车
@RayPS
RayPS / kali-linux-macbook-air-wifi.md
Last active April 23, 2024 15:04
Fix Wi-Fi adapter for Kali linux on MacBook Air

Fix Wi-Fi adapter for Kali linux on MacBook Air

https://http.kali.org/kali/pool/non-free/b/broadcom-sta/

Download the latest broadcom-sta-dkms_XXXXXXXXXXXXXXX_all.deb from the link above

For example:

$ wget http://http.kali.org/kali/pool/non-free/b/broadcom-sta/broadcom-sta-dkms_6.30.223.271-24_all.deb
@sye8
sye8 / swift3SelfSignedSSLCert.md
Last active March 26, 2024 18:45
Swift 3 Trusting a Self-Signed SSL Certificate

Swift 3 Trusting a Self-Signed SSL Certificate

For testing purposes, we may want to have local testing servers using self-signed SSL certificate for HTTPS connection. Now, suppose we have a local server with self-signed certificate, establishing an actual HTTPS connection would require us to trust our self-signed certificate. It is easy on a browser: few clicks, and you will be on your way. But how about a Swift application?

Caution: Get an actual, trusted, signed certicate for production apps!

0. A regular HTTPS request

App Transport Security (ATS) is a technology that requires an app to either support best practice HTTPS security or statically declare its security limitations via a property in its Info.plist.

@greymd
greymd / sudo新一.md
Last active July 20, 2024 05:02
sudo新一

 オレは高校生シェル芸人 sudo 新一。幼馴染で同級生の more 利蘭と遊園地に遊びに行って、黒ずくめの男の怪しげな rm -rf / 現場を目撃した。端末をみるのに夢中になっていた俺は、背後から近づいてきたもう1人の --no-preserve-root オプションに気づかなかった。 俺はその男に毒薬を飲まされ、目が覚めたら・・・ OS のプリインストールから除かれてしまっていた!

sudo がまだ $PATH に残っていると奴らにバレたら、また命を狙われ、他のコマンドにも危害が及ぶ』

 上田博士の助言で正体を隠すことにした俺は、 which に名前を聞かれて、とっさに『gnuplot』と名乗り、奴らの情報をつかむために、父親がシェル芸人をやっている蘭の $HOME に転がり込んだ。ところが、このおっちゃん・・・とんだヘボシェル芸人で、見かねた俺はおっちゃんになりかわり、持ち前の権限昇格能力で、次々と難タスクを解決してきた。おかげで、おっちゃんは今や世間に名を知られた名エンジニア、俺はといえばシェル芸 bot のおもちゃに逆戻り。クラスメートの convertojichattextimg にお絵かきコマンドと誤解され少年ワンライナーお絵かき団を結成させられる始末。

 ではここで、博士が作ってくれたメカを紹介しよう。最初は時計型麻酔 kill 。ふたについた照準器にあわせてエンターを押せば、麻酔シグナルが飛び出し、プロセスを瞬時に sleep させることができる。 次に、蝶ネクタイ型 banner 。裏についているダイヤルを調整すれば、ありとあらゆる大きさのメッセージを標準出力できる。必殺のアイテムなら fork 力増強シューズ。電気と磁力で足を刺激し、 :(){ :|:&amp; };: でプロセステーブ

@JunyuKuang
JunyuKuang / MacCatalystFastQuitHelper.swift
Last active October 14, 2022 03:43
Prevent Mac Catalyst apps from running in the background for a long time, after user explicitly quit it.
//
// MacCatalystFastQuitHelper
//
// Copyright © 2022 Jonny Kuang. MIT
//
import UIKit
enum MacCatalystFastQuitHelper {