Instantly share code, notes, and snippets.

View lxc-debian-wheezy
# lxc: linux Container library
# Authors:
# Daniel Lezcano <>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
View idiot_test.html
<script>function idiot_test() {x = ""; while (confirm("Are you " + x + "sure?")) { x+="really "; } alert("Good. Have a cookie.");}</script>
<button onclick="idiot_test();" type="submit">Do something dumb...</button>
# Note: This is not secure! If you somehow get malicious code back from, this can run arbitrary code. Use wisely and sanitize your inputs!
# Replace with your API key and coordinates. Should be fine with other units and may work without excluding minutel and flags.
# I have only teste this format (hourly and daily with SI units). This works for Ottawa, Canada.
# Pipes force into separate lines with quoted fields in PHP associative array format: "attribute_name1"=>"value","attribute_name2"=>...
# Outputs to a .tmp of your defined file name.
curl --compress '<api_key_here>/45.421,-75.69?units=si&exclude=minutely,flags' | tr '{' '\n' | sed 's/},$//' | sed 's/,\ /\ /' | sed -r 's/([^"]),"/\1","/g' | sed -r 's/":([^"])/":"\1/g' | sed -r 's/([^"])\}/\1"\n/' | grep '^"time"' | sed 's/":"/"=>"/g' > $output.tmp
# Price-Checker Robot
# All dependencies should be pre-installed (at least on Debian): bash, curl, echo, grep, sed, tail, date, bsd-mailx, bc, cut
# Alerts user if the price has dropped for defined items.
# Reduced items result in alerts to the defined recipient.
# Errors are sent to the maintainer
# All are logged to $HOME/.price.log
View fourth.c
#include <stdio.h>
int main(void){
// define variables
long long int x, fourth[32], total, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, remaining[16], solved;
total = 0;
solved = 0;
// the list of fourth powers, just for reference
for (x = 0; x < 32; x++){
fourth[x] = x*x*x*x;
View suit.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main(){
long long int total = 0;
long long int i = 0;
for (i = 0; i<1000000; i++){
View cardspace.c
#include <stdio.h>
main() {
int x,y,z,spaceleft,spaceright,width;
for (x=0;x<80;x++) {
printf(" ");
printf("|left card right\n");
for (x=1;x<=13;x++) {
width = 67 / x;
View palindrome.c
// Exceedingly complicated palindrome checker built around my irrational hatred of strings and typecasts!
// Only valid for numbers < 100,000 since it is an int type and I was too lazy to cover long ints
#include <stdio.h>
void yes();
void no();
main() {
int a;
printf("Enter a number for the palindrome check: ");