Skip to content

Instantly share code, notes, and snippets.

@prime31
prime31 / Sriracha Sauce
Created February 9, 2014 02:19
Sriracha Sauce recipe
Ingredients:
- 1.5 lbs of hot peppers. Mix and match whatever you want: jalepenos, anaheims, haberneros, etc. If you can get at least 0.5 lb ripened red I recommend doing so but if you cant all green peppers works as well. If you don't want it too hot don't add all the seeds.
- 8 T honey (preferably local, raw honey. If you don't really worry about what you eat you can use suger/brown sugar)
- 6 cloves of garlic
- 3 t salt
- 1/2 cup vinegar (preferably raw Apple Cider vineger. If you don't really worry about what you eat you can use white vinegar)
@msurguy
msurguy / index.blade.php
Created February 9, 2014 00:38
Example of extracting JS files for AJAX in Laravel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AJAX</title>
</head>
<body>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define N 10
int sort[N];
int buffer[N];
void mergeSort(int n, int x[]){
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#define N 10
void bubbleSort(int num, int sort[])
{
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@allanmac
allanmac / sha256.cu
Last active May 2, 2025 07:10
A CUDA SHA-256 subroutine using macro expansion
// -*- compile-command: "nvcc -m 32 -arch sm_35 -Xptxas=-v,-abi=no -cubin sha256.cu"; -*-
//
// Copyright 2013 Allan MacKinnon <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@renooble
renooble / autocomplete_address.js
Created January 28, 2014 03:29
autocomplete address with
// this is the get the address with hitting the enter button without submitting
$(function() {
$("#id_address")
.geocomplete()
.bind("geocode:result", function(event, result){
$.log(result.formatted_address);
@jouyouyun
jouyouyun / test-window.go
Created January 27, 2014 08:33
Test Window
package main
import (
"fmt"
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
func main() {
X, err := xgb.NewConn()
@AgrimPrasad
AgrimPrasad / index.html
Created January 27, 2014 06:18 — forked from benjchristensen/index.html
Live Timeline Graph using D3.js
<!--
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@karthikeyann
karthikeyann / meminfo.py
Created January 24, 2014 06:28
Compiles CUDA file and displays Kernel memory requirements in a table (removes hassle of searching nvcc -Xptxas=-v output)
#!/usr/bin/python
#Compiles CUDA file and displays Kernel memory requirements in a table
import sys
import subprocess
def startpos(line):
found=0;
val=0;
for each in line:
if(found==0 and (each in "1234567890")):
found=1