Skip to content

Instantly share code, notes, and snippets.

@larsonmars
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/"
View vlc-recipe.sh
#!/bin/bash
# tested on Debian 7 and Ubuntu 14.04
set -e
set -x
export LANG=C
APP="VLC"
LOWERAPP="vlc"
JOBS=4
View build-libcurl.sh
#!/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' | \
@cookrn
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?
fetch!
end
write_cached_screenfetch!
BEGIN {
COMMAND = 'screenfetch'.freeze
@myusuf3
myusuf3 / delete_git_submodule.md
Created Nov 3, 2014
How effectively delete a git submodule.
View delete_git_submodule.md

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
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
/proc.
If you have not done it yet, please do the following:
mount -t fdescfs fdesc /dev/fd
mount -t procfs proc /proc
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active Nov 27, 2021
how to delete a git tag locally and remote
View git-tag-delete-local-and-remote.sh
# 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
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
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)
{