Skip to content

Instantly share code, notes, and snippets.

View sneetsher's full-sized avatar
🙂
I may be slow to respond.

Abdellah C. sneetsher

🙂
I may be slow to respond.
  • Jijel, Algeria
View GitHub Profile
@sneetsher
sneetsher / unity-xkbmod.c
Created January 20, 2015 15:49
a simple prototype keyboard modifiers indicator for Unity.
/*
* unity-xkbmod.c
*
* Copyright 2014 Sneetsher <sneetsher@localhost>
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
@sneetsher
sneetsher / svg_slice.py
Created January 20, 2015 16:10
SVG is an XML, you can use this python script to generate slices. Actually, it does not slice it, but uses same copy of input file with different values of viewBox to show only target area.
#!/usr/bin/env python
"""
Generate slices
python svg_slice.py 2 1 askUbuntu.svg
ie: 2x1 grid
Then use Inkscape to export PDF for each slice/cell
@sneetsher
sneetsher / locate-pointer.c
Last active July 6, 2021 13:59
Some windows manager missing option to locate mouse pointer as accessibity feature.
/*
*
* File: locate-pointer.c
*
* Some windows manager missing option to locate mouse pointer as accessibity feature.
* To get transparent window need to activate `composite` service for wm.
* Coded in c / xlib / cairo so it can work in most wm's.
*
* Coded by: Abdellah Chelli
* Date: January 2015
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_OUTLINE_H
#include <hb.h>
/* Example code of using harfbuzz together with Core Text APIs. */
#include <hb-coretext.h>
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr, "usage: %s <PostScript-Name> <text>\n", argv[0]);
return 1;
}
@sneetsher
sneetsher / indicator_demo.cs
Created March 26, 2015 08:09
Ubuntu Unity - indicator demo
/*
Compile & Run:
dmcs -pkg:gtk-sharp-2.0 -pkg:appindicator-sharp-0.1 indicator_demo.cs
mono indicator_demo.exe
*/
using Gtk;
using AppIndicator;
#!/bin/bash
set -e
if [ $UID -ne 0 ]
then
sudo $0
fi
readonly BAT_LIMIT_PATH=/sys/devices/platform/sony-laptop/battery_care_limiter
readonly USB_CHARGE_PATH=/sys/devices/platform/sony-laptop/usb_charge
@sneetsher
sneetsher / pango_layout_word_wrap.c
Created December 18, 2015 21:33 — forked from bert/pango_layout_word_wrap.c
Pango layout word wrap example
/*!
* \file pango_layout_word_wrap.c
* \brief pango layout word wrap
*
* \author Ben Pfaff http://benpfaff.org
*
* In working with Pango I found an oddity that I do not understand.
* It may be a bug, or it might just be my misunderstanding.
*
* As part of a table layout procedure for printing, my code wishes to find out
@sneetsher
sneetsher / crc16.c
Created March 25, 2016 10:34 — forked from jlamothe/crc16.c
CRC16 checksum calculator
#include <stdint.h>
#define CRC16 0x8005
uint16_t gen_crc16(const uint8_t *data, uint16_t size)
{
uint16_t out = 0;
int bits_read = 0, bit_flag;
/* Sanity check: */
@sneetsher
sneetsher / ubuntu-raid.sh
Created January 6, 2017 10:14 — forked from umpirsky/ubuntu-raid.sh
Install Ubuntu on RAID 0 and UEFI/GPT system
# http://askubuntu.com/questions/505446/how-to-install-ubuntu-14-04-with-raid-1-using-desktop-installer
# http://askubuntu.com/questions/660023/how-to-install-ubuntu-14-04-64-bit-with-a-dual-boot-raid-1-partition-on-an-uefi%5D
sudo -s
apt-get -y install mdadm
apt-get -y install grub-efi-amd64
sgdisk -z /dev/sda
sgdisk -z /dev/sdb
sgdisk -n 1:0:+100M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -n 2:0:+8G -t 2:fd00 -c 2:"Linux RAID" /dev/sda