Skip to content

Instantly share code, notes, and snippets.

larsonmars / w2lp.c
Last active Feb 16, 2019
WSL windows to linux path converter
View w2lp.c
/* w2lp.c
* 2017 by Lars Stockmann
* released in the public domain
#include <stdio.h>
#define PRE_PATH "/mnt/"
# tested on Debian 7 and Ubuntu 14.04
set -e
set -x
export LANG=C
# build on CentOS 6.9 (64 bit)
set -e
set -x
version=$(wget -q -O- ';O=D' | \
cookrn / screenfetched.rb
Created May 27, 2016
An easy way to cache `screenfetch` results for a set amount of time so that every new terminal doesn't re-run it
View screenfetched.rb
#!/usr/bin/env ruby
if fetched_file_blank? or fetched_file_expired?
COMMAND = 'screenfetch'.freeze
myusuf3 /
Created Nov 3, 2014
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
dankogai / gist:11215062
Created Apr 23, 2014
bash-4.3.11_1 in FreeBSD ports
View gist:11215062
% cat /usr/ports/shells/bash/pkg-message
bash requires fdescfs(5) mounted on /dev/fd and procfs(5) mounted on
If you have not done it yet, please do the following:
mount -t fdescfs fdesc /dev/fd
mount -t procfs proc /proc
mobilemind /
Last active Nov 27, 2021
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
yoggy / uuid_test.c
Created Jan 8, 2013
libuuid sample program
View uuid_test.c
// 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>
vsajip / kbhit.c
Created Feb 19, 2012
Keyboard hit testing
View kbhit.c
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
int kbhit(void)
struct termios oldt, newt;
int ch;
int oldf;
View strfry_example.c
/* 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)