Skip to content

Instantly share code, notes, and snippets.

View grepwood's full-sized avatar

grepwood

  • /root
View GitHub Profile
#!/bin/bash
CURRENT_KERNEL=`uname -r`
OLD_KERNELS=`ls /usr/src/ -l | grep -v ">"| awk '{print $9}' | grep linux | grep -v $CURRENT_KERNEL | sed -r 's/^.{6}//'`
AMOUNT_OF_OLD_KERNELS=`ls /usr/src/ -l | grep -v ">" | awk '{print $9}' | grep linux | grep -v $CURRENT_KERNEL | wc -l`
echo "Amount of kernels to get rid of: $AMOUNT_OF_OLD_KERNELS"
read -r -p "Are you sure? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
for (( COUNTER=0; COUNTER<$AMOUNT_OF_OLD_KERNELS; COUNTER++ ))
do
@solusipse
solusipse / ytwebm.py
Last active August 29, 2015 14:00
Youtube to webm converter
'''
Sample usage:
python ytwebm.py https://www.youtube.com/watch?v=dQw4w9WgXcQ -s 01:45 -l 5
This will create webm file from youtube video from 01:45 to 01:50
'''
import youtube_dl, subprocess, os, argparse
class Downloader:
@armornick
armornick / playwav.c
Created August 24, 2012 07:31
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@jpfuentes2
jpfuentes2 / rbenv-install-system-wide.sh
Created March 8, 2012 19:47
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core