Skip to content

Instantly share code, notes, and snippets.

@maluta
maluta / strfry_example.c
Created June 27, 2011 21:57
strfry example
/* gcc -Wall -o strfry_example strfry_example.c */
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
@vsajip
vsajip / kbhit.c
Created February 19, 2012 17:07
Keyboard hit testing
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
int kbhit(void)
{
struct termios oldt, newt;
int ch;
int oldf;
@yoggy
yoggy / uuid_test.c
Created January 8, 2013 11:19
libuuid sample program
//
// libuuid sample program
//
// library install for debian
// $ sudo apt-get install uuid-dev
//
// compile
// $ gcc uuid_test.c -luuid -o uuid_test
//
#include <stdio.h>
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@dankogai
dankogai / gist:11215062
Created April 23, 2014 13:24
bash-4.3.11_1 in FreeBSD ports
% cat /usr/ports/shells/bash/pkg-message
======================================================================
bash requires fdescfs(5) mounted on /dev/fd and procfs(5) mounted on
/proc.
If you have not done it yet, please do the following:
mount -t fdescfs fdesc /dev/fd
mount -t procfs proc /proc
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@cookrn
cookrn / screenfetched.rb
Created May 27, 2016 17:00
An easy way to cache `screenfetch` results for a set amount of time so that every new terminal doesn't re-run it
#!/usr/bin/env ruby
if fetched_file_blank? or fetched_file_expired?
fetch!
end
write_cached_screenfetch!
BEGIN {
COMMAND = 'screenfetch'.freeze
#!/bin/sh
# build on CentOS 6.9 (64 bit)
# https://github.com/probonopd/AppImages/issues/187
# https://github.com/TheAssassin/zsync2/issues/4
# https://launchpad.net/~djcj/+archive/ubuntu/libcurl-slim
set -e
set -x
# https://github.com/mxe/mxe/blob/master/src/curl.mk
version=$(wget -q -O- 'https://curl.haxx.se/download/?C=M;O=D' | \
#!/bin/bash
# tested on Debian 7 and Ubuntu 14.04
set -e
set -x
export LANG=C
APP="VLC"
LOWERAPP="vlc"
JOBS=4
@larsonmars
larsonmars / w2lp.c
Last active February 16, 2019 16:25
WSL windows to linux path converter
/* w2lp.c
*
* 2017 by Lars Stockmann
* released in the public domain
*/
#include <stdio.h>
#define PRE_PATH "/mnt/"