This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#tbl tr').each(function () | |
{ | |
var $row = $(this); | |
$row.children().each(function () | |
{ | |
var $cell = $(this); | |
// do something with the current <tr> and <td> | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned char i; | |
unsigned char j; | |
/*Port Definitions*/ | |
int Max7219_pinCLK = 10; | |
int Max7219_pinCS = 9; | |
int Max7219_pinDIN = 8; | |
unsigned char disp1[38][8]={ | |
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A | |
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Needs Ruby 1.9 as a minimum | |
curl -s https://api.github.com/orgs/<insert org>/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See what you’ve been working on today: | |
$ git log --since="00:00:00" --no-merges --oneline --author=<[email protected]> https://t.co/CMcVb2EMyo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table = document.getElementsByClassName('advanced_dns')[0]; | |
var rows = table.getElementsByTagName('tr'); | |
var i, len, row; | |
var hostname, type, priority, ttl, destination; | |
var output = ''; | |
output += '$TTL 600\n'; // start with default TTL | |
// skip header and last two rows (add new entry, delete all entries) | |
for (i = 1, len = rows.length - 2; i < len; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: kubernetes-dashboard | |
labels: | |
k8s-app: kubernetes-dashboard | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code to change a request from / to /app1/ | |
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2 | |
If urls in the response contain absolute urls it might be required to use this: | |
acl no_redir url_beg /app1/ | |
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2 if !no_redir | |
The code makes sure that the method and url-path behind the / stays the same. Which method you need exactly might depend on the application thats running. | |
For readability of the above how change a request from /app1/ to /app1/app1redir/ | |
reqirep ^([^\ :]*)\ /app1/(.*) \1\ /app1/app1redir/\2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redirect prefix http://example.com code 301 if { hdr(host) -i www.example.com } | |
Please see the documentation of the redirect prefix rule for more information. | |
If you are using a newer version of HAProxy, i.e. at least 1.6, you can use a more generic syntax which allows to redirect any host, not just explicitly named | |
http-request redirect prefix http://%[hdr(host),regsub(^www\.,,i)] code 301 if { hdr_beg(host) -i www. } | |
Here, we are using the regsub filter to dynamically generate the correct hostname without the www. prefix. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO $$ DECLARE | |
tabname RECORD; | |
BEGIN | |
FOR tabname IN (SELECT tablename | |
FROM pg_tables | |
WHERE schemaname = current_schema()) | |
LOOP | |
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(tabname.tablename) || ' CASCADE'; | |
END LOOP; | |
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# -------------------------- | |
# Ripped from django project | |
# -------------------------- | |
from django.contrib.contenttypes.models import ContentType | |
from django.utils.translation import ugettext as _ | |
from django.utils.encoding import force_unicode |
OlderNewer