Skip to content

Instantly share code, notes, and snippets.

@scratchyourbrain
scratchyourbrain / C Program to Display Fibonacci Series
Created December 18, 2014 06:54
C Program to Display Fibonacci Series
#include <stdio.h>
int main()
{
int count, n, t1=0, t2=1, display=0;
printf("Enter number of terms: ");
scanf("%d",&n);
printf("Fibonacci Series: %d %d ", t1, t2); /* Displaying first two terms */
count=2; /* count=2 because first two terms are already displayed. */
while (count<n)
{
@dmgerman
dmgerman / SQL-set-operations.org
Last active August 29, 2015 14:21
CSC370: SQL set operations

Set operations in SQL

First create some tables

\d
anonymous
anonymous / gist:5575774
Created May 14, 2013 13:16
--
-- open currently active Chrome tab with Safari
-- forked from https://gist.github.com/3151932 and https://gist.github.com/3153606
--
property theURL : ""
tell application "Google Chrome"
set theURL to URL of active tab of window 0
end tell
if appIsRunning("Safari") then
@paralax
paralax / Makefile
Last active July 7, 2017 18:08
vtwebd - a very tiny web daemon that servers static content
all: vtwebd
request.o: request.c
gcc -g -O2 -c request.c
vtwebd.o: main.c
gcc -pthread -g -O2 -c main.c
vtwebd: vtwebd.o request.o
gcc -pthread -g -o vtwebd main.o request.o
@stvhwrd
stvhwrd / wysiwyg.js
Created November 22, 2018 02:43
Turn webpage into WYSIWYG editor
/* Run this in console of dev tools in browser to make all text on rendered page editable (but retains style etc) */
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
#!/usr/bin/python
# Title: Reddit Data Mining Script
# Authors: Clay McLeod
# Description: This script mines JSON data
# from the Reddit front page and stores it
# as a CSV file for analysis.
# Section: Python
# Subsection: Data Science
want=["domain", "subreddit", "subreddit_id" "id", "author", "score", "over_18", "downs", "created_utc", "ups", "num_comments"]
@stvhwrd
stvhwrd / setup_tmux_zsh.sh
Last active July 9, 2020 04:20
Install tmux and zsh on a remote server without root
#!/usr/bin/env bash
# Connect to the server..
# ssh username@server_ip
mkdir ~/.local;
# Download source and build libevent
cd /tmp;
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz;
tar xvfz libevent-2.1.8-stable.tar.gz;
@jonpugh
jonpugh / git-pull-recursive.rb
Last active October 20, 2021 03:20
Lots of repos? Try "git-pull-recursive" to run "git pull" on all subfolders with a .git folder inside. Thanks to http://snipplr.com/view/62314/perform-git-pull-on-subdirectory-recursive/
# For use in Chef:
# Adds a command: git-pull-recursive
file "/usr/local/bin/git-pull-recursive" do
owner "root"
group "root"
mode "0755"
action :create
content 'find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;'
end
@leoapost
leoapost / gist:4318441
Created December 17, 2012 13:55
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;
@mbostock
mbostock / .block
Last active March 1, 2024 06:07
The Gist to Clone All Gists
license: gpl-3.0