Skip to content

Instantly share code, notes, and snippets.

View 345161974's full-sized avatar
🎯
Focusing

Lucas 345161974

🎯
Focusing
View GitHub Profile
<?php # -*- coding: utf-8 -*-
/**
* Create a nav menu with very basic markup.
*
* @author Thomas Scholz http://toscho.de
* @version 1.0
*/
class T5_Nav_Menu_Walker_Simple extends Walker_Nav_Menu
{
/**
@mythosil
mythosil / ev_timer.c
Created October 21, 2011 09:56
libevent timeout sample
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <event.h>
#define BUFSIZE 256
#define TIMEOUT_SEC 3
void read_handler(int fd, short event, void *arg)
{
@uhziel
uhziel / SetConsoleCtrlHandler.c
Created January 6, 2012 02:45
Set Console Ctrl Handler in Windows
/*
* filename: SetConsoleCtrlHandler.c
* description:
* This is a example of the SetConsoleCtrlHandler function that is used to
* install a control handler.
* via http://msdn.microsoft.com/en-us/library/ms685049(v=VS.85).aspx
* author: uhziel(uhziel@gmail.com)
* history:
* version date ps
* ------- ---------- --------------------------------
@tetsuok
tetsuok / answer_word_count.go
Created April 2, 2012 02:20
An answer of the exercise: Maps on a tour of Go
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
m := make(map[string]int)
a := strings.Fields(s)
@tetsuok
tetsuok / answer_pic.go
Created April 2, 2012 02:40
An answer of the exercise: Slices on a tour of Go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
// Allocate two-dimensioanl array.
a := make([][]uint8, dy)
for i := 0; i < dy; i++ {
a[i] = make([]uint8, dx)
}
@jsok
jsok / sqlite3_test.c
Created June 15, 2012 14:34
sqlite3 C example
#include <stdio.h>
#include <sqlite3.h>
int main(void)
{
sqlite3 *db;
sqlite3_stmt *stmt;
sqlite3_open("expenses.db", &db);
@tacaswell
tacaswell / simp_zoom.py
Last active February 12, 2023 07:19
factory for adding zoom callback to matplotlib graphs
import matplotlib.pyplot as plt
def zoom_factory(ax,base_scale = 2.):
def zoom_fun(event):
# get the current x and y limits
cur_xlim = ax.get_xlim()
cur_ylim = ax.get_ylim()
# set the range
cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@jeetsukumaran
jeetsukumaran / build-gcc.sh
Last active May 6, 2024 18:18
Build and Install GCC Suite from Scratch
#! /bin/bash
GCC_VERSION="5.2.0"
WORKDIR="$HOME/src/"
INSTALLDIR="/platform"
## NOTE: XCode must be installed (through App Store) and the following run to install command-line tools.
## THIS IS IMPORTANT! Among other things, it creates '/usr/include' and installs the system header files.
# xcode-select --install
@waqasjamal-zz
waqasjamal-zz / gist:7428185
Last active February 22, 2021 19:37
Python Code for adding posts to WordPress remotely
import urllib
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods import posts
import xmlrpclib
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import os
########################### Read Me First ###############################
'''
------------------------------------------In DETAIL--------------------------------