Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@17twenty
17twenty / fizzbuzz.c
Last active February 11, 2021 14:01
Shortest FizzBuzz in C. Implicit declaration of printf but libc is linked against any way so nyeh.
main(i){for(;i++<100;)printf(i%3?i%5?"%d\n":"Buzz\n":i%5?"Fizz\n":"FizzBuzz\n",i);}
@17twenty
17twenty / gist:3047930
Created July 4, 2012 15:39
Makefile template
# Makefile template
CC = gcc
CFLAGS = -W -Wall -ansi -pedantic -g
LDFLAGS =
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
TARGET = executable
@17twenty
17twenty / gist:3360056
Created August 15, 2012 13:20
brain_no_worky.c
#include <stdio.h>
struct foo {
const char *string;
};
int main(int argc, char **argv)
{
struct foo sourceFoo;
struct foo destFoo;
@17twenty
17twenty / simple.vala
Created September 14, 2012 13:31
Doesn't work at the moment... something isn't rendering :(
all:
valac --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg libsoup-2.4 main.vala --thread --pkg gio-2.0 --pkg cairo -o colourl
---
// Colourl is a simple app to retrieve nice patterns from ColorLOVERS
// Copyright (C) 2012 Nick Glynn <exosyst@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
@17twenty
17twenty / get_rsync.sh
Last active December 11, 2015 00:39
Simple bash script to print out an rsync command for use with copying files from a remote system
#!/usr/bin/env bash
# Simple script to create a pastable rsync command
foo="$(readlink -f "$1")"
# Use everybodys favourite Dynamic IP address checker to get our external IP address.
my_external_ip=$(wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
#echo $my_external_ip
@17twenty
17twenty / gist:4560033
Created January 17, 2013 21:39
Samba on Fedora 18
I ended up doing the following to get a publically shared folder on F18 after installing samba and samba-client
Used the graphical tool to allow samba through the firewalld (it's just called firewall in the applications) or alternatively kill it with prejudice:
# sudo systemctl disable firewalld
# sudo systemctl stop firewalld
Tell the system to enable and start smbd and nmbd
# sudo systemctl enable smb
# sudo systemctl enable nmb
@17twenty
17twenty / gist:4985374
Created February 19, 2013 12:20
Git diff odt files
To get Git to diff between your odt/odp/ods files you will need to do the following things:
Install a conversion tool
$ sudo yum install odt2txt
Create your git config info directory if it's not already there
$ mkdir -p ~/.config/git/info
Add in attributes (you can paste this straight in or edit the file accordingly)
$ cat > ~/.config/git/info/attributes <<DELIM
@17twenty
17twenty / money.cxx
Last active December 17, 2015 04:09
Found some old code, it didn't work. Started messing with it in response to questions... uhh, Yeah :-/
#include <exception>
#include <iostream>
class Money {
public:
Money() : m_value(0) {
std::cout << "Money() Value is " << m_value << std::endl;
}
@17twenty
17twenty / quicksort.py
Created June 2, 2013 17:19
Quicksort Quick Implementation
#!/usr/bin/env python
"""Simple implementation of a quicksort"""
def quicksort(array):
if len(array) <= 1:
return array
pivot = array.pop(len(array) / 2) # Naive?
print "Chose pivot ", (pivot)
les = []
@17twenty
17twenty / local.conf
Last active December 20, 2015 18:09
local.conf used for Feabhas EL503
#
# This file is your local configuration file and is where all local user settings
# are placed. The comments in this file give some guide to the options a new user
# to the system might want to change but pretty much any configuration option can
# be set in this file. More adventurous users can look at local.conf.extended
# which contains other examples of configuration which can be placed in this file
# but new users likely won't need any of them initially.
#
# Lines starting with the '#' character are commented out and in some cases the
# default values are provided as comments to show people example syntax. Enabling