Skip to content

Instantly share code, notes, and snippets.

@yegle
yegle / bash-invocation.md
Created January 5, 2012 11:44
Bash Shell启动方式与RC脚本

Bash Shell启动方式与rc脚本

Shell的不同分类

根据启动Bash Shell的方式不同,对Shell有两种分类方式

登录Shell与非登录Shell

根据Shell的启动方式不同,可以将Shell分为

@rednaxelafx
rednaxelafx / HelloWorld.java
Created May 16, 2012 14:15
Print the list of invoked methods
public class HelloWorld {
private static int foo() {
return 42;
}
private static void bar() {
}
public static void main(String[] args) throws Exception {
foo();
@sing1ee
sing1ee / gist:5971946
Last active March 27, 2024 06:37
Google面试题:扔鸡蛋问题

Google面试题:扔鸡蛋问题

原题描述

两个软硬程度一样但未知的鸡蛋,它们有可能都在一楼就摔碎,也可能从一百层楼摔下来没事。有座100层的建筑,要你用这两个鸡蛋通过最少的次数确定哪一层是鸡蛋可以安全落下的最高位置。可以摔碎两个鸡蛋

方法分析

看到这个题目,最保险的方法就是一层一层试验,但这样只需要一个鸡蛋就可以了。我们现在有两个鸡蛋,完全可以用有更快的方法。

@aras-p
aras-p / preprocessor_fun.h
Last active November 15, 2024 09:22
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@staltz
staltz / introrx.md
Last active November 19, 2024 13:42
The introduction to Reactive Programming you've been missing
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active November 5, 2024 02:36
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@bikz05
bikz05 / facedetection.ipynb
Last active June 11, 2016 09:50
Face Detection using OpenCV
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@raphw
raphw / BootstrapAgent.java
Last active September 6, 2024 22:58
An example agent that intercepts a method of the bootstrap class loader.
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassInjector;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
@qsLI
qsLI / gist:1f10fa5b8b76f3b5efaf74ad3d6da413
Created September 21, 2016 04:01 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@odytrice
odytrice / Sql Server Kill Processes.sql
Last active October 18, 2018 05:19
Troubleshooting SQL Server
# DANGER - Kills all processes for a specific database
-- DECLARE @SQL varchar(max);
-- SELECT @SQL = COALESCE(@SQL,'') + 'Kill ' + Convert(varchar, r.session_id) + ';' from sys.dm_exec_requests r left join sys.dm_os_waiting_tasks t
-- on r.session_id = t.session_id where r.session_id >= 50 and r.session_id <> @@spid
-- EXEC(@SQL)