Skip to content

Instantly share code, notes, and snippets.

@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
@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
@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;
#!/bin/bash
# tested on Debian 7 and Ubuntu 14.04
set -e
set -x
export LANG=C
APP="VLC"
LOWERAPP="vlc"
JOBS=4
#!/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' | \
@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)
{
@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/"
@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
@mmozeiko
mmozeiko / !README.md
Last active April 19, 2024 07:40
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.

Run python.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.32.17.2 and v10.0.22621.0.

You can list available versions with python.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe from output folder, first run setup.bat - after that PATH/INCLUDE/LIB env variables will be setup to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).