This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
BASEURL=http://kernel.ubuntu.com/~kernel-ppa/mainline | |
BUILDIR=${BUILDIR:-$HOME/.build} | |
ARCH=$(dpkg --print-architecture) | |
VERSIONS=$(curl -s $BASEURL/ | sed -n 's/.*href="v\([^/"]*\).*/\1/p' | grep -v rc | sort -t. -k 1,1rn -k 2,2rn -k 3,3rn | head -n 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: linux-4.15.0/drivers/net/wireless/ath/Kconfig | |
=================================================================== | |
--- linux-4.15.0.orig/drivers/net/wireless/ath/Kconfig 2018-01-28 22:20:33.000000000 +0100 | |
+++ linux-4.15.0/drivers/net/wireless/ath/Kconfig 2018-07-01 07:56:11.988486650 +0200 | |
@@ -22,6 +22,9 @@ | |
if WLAN_VENDOR_ATH | |
+config ATH_USER_REGD | |
+ bool "Do not enforce EEPROM regulatory restrictions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NastyCustomView extends View implements InteractiveViewHelper.Callback { | |
private final InteractiveViewHelper mInteractiveViewHelper = | |
new InteractiveViewHelper(this, this); | |
@Override | |
protected void onAttachedToWindow() { | |
super.onAttachedToWindow(); | |
mInteractiveViewHelper.onAttachedToWindow(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(!!(COND))*2-1] | |
#define COMPILE_TIME_ASSERT3(X,L) STATIC_ASSERT(X,static_assertion_at_line_##L) | |
#define COMPILE_TIME_ASSERT2(X,L) COMPILE_TIME_ASSERT3(X,L) | |
#define COMPILE_TIME_ASSERT(X) COMPILE_TIME_ASSERT2(X,__LINE__) | |
COMPILE_TIME_ASSERT(sizeof(long) == 8); | |
int main() { | |
COMPILE_TIME_ASSERT(sizeof(int) == 4); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ioctl(fd, TIOCSBRK, (int []) {50}); | |
// instead of: | |
int duration = 50; | |
ioctl(fd, TIOCSBRK, &duration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void foo(char * array[]) { | |
while(*array) printf("%s ", *array++); | |
} | |
foo((char * []) {"Hello", "World", 0}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void sort(int *a, unsigned size) { | |
void quick_sort(unsigned first, unsigned last) { | |
void swap(unsigned i, unsigned j) { | |
int tmp = a[i]; a[i] = a[j]; a[j] = tmp; | |
} | |
int partition() { | |
int pivot = a[first]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void foo(int *x) { | |
typeof(x) y; // Declares y with the type of x | |
typeof(*x) z; // Declare z with the type what x points to | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define max(a,b) \ | |
({ __auto_type _a = (a); \ | |
__auto_type _b = (b); \ | |
_a > _b ? _a : _b; }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct pstring { | |
unsigned length; | |
char content[0]; | |
}; | |
struct pstring my_string = (struct pstring *) malloc(sizeof (struct pstring) + my_length); | |
mystring->length = my_length; |