Skip to content

Instantly share code, notes, and snippets.

View gsora's full-sized avatar
🤙
Vibin'

Gianguido Sorà gsora

🤙
Vibin'
View GitHub Profile
@gsora
gsora / beat.c
Created April 18, 2014 22:05
4/4 with arbitrary BPM "metronome" in C
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define MINUTE_MS 60000
void tick(useconds_t);
int main(int argc, char *argv[]){
@gsora
gsora / getsIsUnsafe.c
Created June 20, 2014 18:21
This is why gets() is unsafe
#include <stdio.h>
#define BUF 5
int main(void) {
int a = 2;
char word[BUF];
printf("Declaread an integer a = 2, and a string.\nThis is where the gets kicks in.\nThe string where gets() will write is big 5, try to write someting > 5 and see what appends!\ngets: ");
gets(word);
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront

Keybase proof

I hereby claim:

  • I am peppelakappa on github.
  • I am gsora (https://keybase.io/gsora) on keybase.
  • I have a public key whose fingerprint is B66C 1724 76BA 7724 365C 0C0A A5BD 4FD9 415A C94B

To claim this, I am signing this object:

entry = {
cell = PSLinkCell;
icon = "/Applications/Preferences.app/Settings.png";
isController = 1;
label = "NoScreenshotty";
ALSettingsPath = "/var/mobile/Library/Preferences/me.urandom.noscreenshotty.plist";
ALSettingsKeyPrefix = "NoScreenshotty-";
ALSectionDescriptors = (
{
title = "System Applications";
START: batterydaemon session has been started ->: 01-09-2015 16:52
LOG: been awake for 9.960492 seconds, or 0.166008 minutes.
LOG: been awake for 243.998642 seconds, or 4.066644 minutes.
LOG: been awake for 16.560452 seconds, or 0.276008 minutes.
LOG: been awake for 16.591656 seconds, or 0.276528 minutes.
LOG: been awake for 105.462189 seconds, or 1.757703 minutes.
LOG: been awake for 16.559418 seconds, or 0.275990 minutes.
LOG: been awake for 57.357460 seconds, or 0.955958 minutes.
LOG: been awake for 19.183556 seconds, or 0.319726 minutes.
LOG: been awake for 254.495499 seconds, or 4.241591 minutes.
@gsora
gsora / xorg-x11-drv-mtrack-git.spec
Last active November 9, 2015 19:43
SPEC file to build xf86-input-mtrack
Name: xorg-x11-drv-mtrack
Version: git
Release: 1%{?dist}
Summary: Multitouch touchpad driver
License: GPLv2
URL: https://github.com/p2rkw/xf86-input-mtrack/
Source0: https://github.com/p2rkw/xf86-input-mtrack/
BuildRequires: xorg-x11-util-macros xorg-x11-server-devel mtdev-devel
Section "InputClass"
MatchIsTouchpad "on"
Identifier "Touchpads"
Driver "mtrack"
# ignore thumb and palm rest
Option "IgnoreThumb" "true"
Option "IgnorePalm" "true"
Option "DisableOnPalm" "true"
<?xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<dict>
<key>ProductBuildVersion</key>
<string></string>
<key>ProductName</key>
<string>Linux</string>
<key>ProductVersion</key>
<string>Arch Linux</string>
</dict>
@gsora
gsora / togglemaxfan
Last active November 18, 2015 16:02
Toggle between automatic and max fan speed on Retina MacBook Pros
#!/bin/bash
SMC=/sys/devices/platform/applesmc.*
MANUAL_VAL=$(cat $SMC/fan1_manual)
MANUAL=$SMC/fan1_manual
MIN=$(cat $SMC/fan1_min)
MAX=$(cat $SMC/fan1_max)
FOUT=$SMC/fan1_output
if [[ $UID != 0 ]]; then