Skip to content

Instantly share code, notes, and snippets.

View xiaozi's full-sized avatar
🎯
Focusing

小子欠扁 xiaozi

🎯
Focusing
View GitHub Profile
@aegypius
aegypius / base62.php
Created April 30, 2010 12:36 — forked from rduarte/base62.php
Base62 Encoding/Decoding
<?php
function base62_encode($num){
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$base = 62;
$result = '';
while($num >= $base) {
$r = $num%$base;
$result = $chars[$r].$result;
$num = $num/$base;
@nibrahim
nibrahim / pygments-pygame.py
Created January 10, 2011 19:24
Using pygments to highlight code for use in pygame Using pygments to highlight code for use in pygame
#!/usr/bin/env python
import pygame
from pygame.locals import *
from pygame.color import Color
from pygments.lexers import PythonLexer
from pygments.styles.emacs import EmacsStyle
@didip
didip / tornado-nginx-example.conf
Created January 30, 2011 05:19
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@rbranson
rbranson / crossdomain.conf
Created February 3, 2011 21:13
nginx Flash XML policy server
# Add this to your nginx.conf under http { }
server {
listen 843;
server_name localhost;
location / {
rewrite ^(.*)$ /crossdomain.xml;
}
@simaob
simaob / crontab_list
Created July 19, 2011 12:04
Backup config file for db_name
# Begin Whenever generated tasks for: backups
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
32 11 * * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name.rb >> ~/Backup/log/whenever_cron.log 2>&1'
0 0 1 12 * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_yearly.rb >> ~/Backup/log/whenever_cron.log 2>&1'
0 0 1 * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_monthly.rb >> ~/Backup/log/whenever_cron.log 2>&1'
@drewjoh
drewjoh / example.php
Last active January 11, 2021 18:06 — forked from mloberg/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
$result = $postmark->to("reciver@example.com")
->subject("Email Subject")
->plain_message("This is a plain text message.")
->attachment('File.pdf', base64_encode(file_get_contents('sample.pdf')), 'application/pdf')
@jackrabb1t
jackrabb1t / CollectionsPredicateFilterSample.java
Created November 18, 2011 13:47
a snippet to filter a list - using apache commons collections Predicate class
import static java.lang.System.out;
import static java.util.Arrays.asList;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
public class ListTests {
public static void main( String[] args ) {
List<String> names = asList( "Ted", "Fred", "Jed", "Ned" );
@limitedmage
limitedmage / arduino.ino
Created March 30, 2012 02:23
Arduino Soundlight
int pin = 11;
int val;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
val = Serial.read();
@pirhoo
pirhoo / jquery.loading.css
Created September 8, 2012 16:17
A jQuery function to add a relative overlay on the current element
.js-loading-overlay {
position:absolute;
top:0; bottom:0;
left:0; right:0;
z-index:199;
background:#fff;
opacity:0.5;
@hofmannsven
hofmannsven / README.md
Last active July 16, 2024 01:30
Git CLI Cheatsheet