Skip to content

Instantly share code, notes, and snippets.

View smalinux's full-sized avatar
🎯
FOCUS

Sohaib Mohamed smalinux

🎯
FOCUS
View GitHub Profile
@claudiosanches
claudiosanches / functions.php
Created January 22, 2014 01:17
WordPress - Get a first image attachment in post
<?php
function odin_get_first_image() {
$attachment = get_children(
array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'DESC',
'numberposts' => 1,
)
puts("أهلًا يا عالم!");
@velicast
velicast / stdc++.h
Created July 17, 2013 17:56
Linux GCC 4.8.0 /bits/stdc++.h header definition.
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@romainl
romainl / countrepeat.md
Last active August 1, 2021 08:43
Repeat last edit n times

Repeat last edit n times

Did you ever wish you could repeat the last edit an arbitrary number of times without mashing the . key?

Well now you can.

Before

......
@anryko
anryko / Makefile
Created March 29, 2016 20:32
Simple kernel module example. Lists process list and count.
obj-m += lkm_hello1.o
KDIR ?= /lib/modules/$(shell uname -r)/build
all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
@dedy-purwanto
dedy-purwanto / 10fastfinger_bot.js
Created December 22, 2011 12:44
BOT for 10fastfingers, automatic typing with adjustable speed
/*
* BOT for 10fastfingers, automatic typing with adjustable speed
* ================================================================
*
* bored in my apartment and decided to hack this game: http://indonesian-speedtest.10fastfingers.com/
* just start the game, when you're ready to type, DON'T TYPE ANYTHING, open up
* your Developer Tools in Chrome (CTRL+SHIFT+J) and click Console tab, and
* then paste the whole code below, then press enter, and enjoy the show.
*
* twitter.com/kecebongsoft
@yagihiro
yagihiro / sample.c
Last active July 29, 2022 11:25
timer sample on linux kernel
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
static void mykmod_timer_handler(unsigned long data);
static unsigned long onesec;
DEFINE_TIMER(mytimer, mykmod_timer_handler, 0, 0);
@richardhsu
richardhsu / git_log_first_email.sh
Created April 9, 2014 09:30
Bash script to pull git repositories, clone them, view log and grab the first email address seen.
#!/bin/bash
# Set up a repos.txt file that contains a list of all the repos
# one repo per line. Then create an emails.txt file which is where
# all the emails will go. It'll be a CSV file so you can verify.
# This is a quick hacky way to get emails, not sure if I covered all
# valid characters in regex but didn't need precision. Feel free to
# make it better!
reponame="https://github.com/[a-zA-Z0-9._-]+/([a-zA-Z0-9._-]+)$"
email="<([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.\w+)>"
@brenns10
brenns10 / Makefile
Last active August 3, 2023 19:51
Linux Character Device Example
obj-m += chardev.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@MyCatShoegazer
MyCatShoegazer / build.bat
Created February 2, 2018 08:05
Hello World NASM boot loader example.
@echo on
echo Bulding bin file...
nasm loader.asm -f bin -o loader.bin
echo Writing bin file to ploppy
partcopy loader.bin 0 200 -f0