Skip to content

Instantly share code, notes, and snippets.

View sistematico's full-sized avatar
🏠
Working from home

Lucas Saliés Brum sistematico

🏠
Working from home
View GitHub Profile
@yeonwoonj
yeonwoonj / ircbot.js
Created February 23, 2011 17:05
super simple IRC bot (node.js)
var os = require('os');
var net = require('net');
// config
var con = net.createConnection(6667,'irc.freenode.net');
var nick = '__YOURNICK__';
var chan = '#__YOURCHANNEL__';
var chatlogs = [];
@felladrin
felladrin / gist:1800645
Created February 11, 2012 15:15
Código PHP para listar subpastas com links
<?php
if ($diretorio = opendir("./"))
{
while(false !== ($pasta = readdir($diretorio)))
{
if(is_dir($pasta) and ($pasta != ".") and ($pasta != ".."))
{
echo "<a href='$pasta'>$pasta</a><br>";
}
}
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@bgallagh3r
bgallagh3r / wp.sh
Last active March 24, 2024 03:12
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@letanure
letanure / estados-cidades.json
Last active July 19, 2024 18:37
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@codeimpossible
codeimpossible / pushstate.js
Created July 20, 2012 19:45
Pushstate example
$('a').click(function(e) {
e.preventDefault();
var url = this.href;
$.get(url, function(html) {
$('.newpage').html(html).animate({ left: "-= 1000px" }, function() {
window.history.pushState({}, "New Page Title", url );
});
});
return false;
});
@balupton
balupton / cors.js
Created September 11, 2012 05:21
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);
@joemiller
joemiller / netpps.sh
Last active January 12, 2024 15:39
shell: quick linux scripts for showing network bandwidth or packets-per-second
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
@erichschroeter
erichschroeter / queue.sh
Created November 28, 2012 13:25
Shell script implementation of a Queue.
#!/bin/bash
#
# This script encapsulates the functionality of a queue. It requires there to be
# an input file with the data in the queue being separated on different lines.
#
INPUT=queue.txt
OUTPUT=trash.txt
CMD=/usr/bin/vlc
@jmwhittaker
jmwhittaker / app.js
Last active November 26, 2021 16:15
Standard compliant stylesheet switcher for HTML5. Works on iOS5 and all modern browsers.
$(document).ready(function()
{
/* Check to see if we have saved a style already, a bit verbose but you get the drift! */
var theme = localStorage.getItem('style');
if (!theme) {
localStorage.setItem('style', 'light');
};
updateTheme();